Example #1
0
        /// <summary>
        /// Sets a project property.
        /// </summary>
        /// <param name="propertyName">Name of the property to set.</param>
        /// <param name="value">Value of the property.</param>
        public override void SetProperty(string propertyName, string value)
        {
            if (propertyName == WixProjectFileConstants.RunPostBuildEvent)
            {
                RunPostBuildEvent runType = (RunPostBuildEvent)Int32.Parse(value, CultureInfo.InvariantCulture);
                if (Enum.IsDefined(typeof(RunPostBuildEvent), runType))
                {
                    value = runType.ToString();
                }
                else
                {
                    value = null;
                }
            }

            base.SetProperty(propertyName, value);
        }
Example #2
0
        // =========================================================================================
        // Methods
        // =========================================================================================

        /// <summary>
        /// Gets a project property.
        /// </summary>
        /// <param name="propertyName">The name of the property to get.</param>
        /// <returns>
        /// Value of the property, or null if the property is unset or inconsistent across configurations.
        /// </returns>
        public override string GetProperty(string propertyName)
        {
            string value = base.GetProperty(propertyName);

            if (propertyName == WixProjectFileConstants.RunPostBuildEvent)
            {
                try
                {
                    RunPostBuildEvent outputType = (RunPostBuildEvent)Enum.Parse(typeof(RunPostBuildEvent), value, true);
                    value = ((int)outputType).ToString(CultureInfo.InvariantCulture);
                }
                catch (ArgumentException)
                {
                    value = null;
                }

                if (value == null)
                {
                    value = ((int)RunPostBuildEvent.OnBuildSuccess).ToString(CultureInfo.InvariantCulture);
                }
            }

            return(value);
        }
        /// <summary>
        /// Bind properties.
        /// </summary>
        protected override void BindProperties()
        {
            if (this.ProjectMgr == null)
            {
                return;
            }
            warningAsErrors = getCfgLogic(nameof(TreatWarningsAsErrors), false);
            outputpath = getCfgString(nameof(OutputPath), defaultOutputPath);
            outputpath = AddSlash(outputpath);
            intermediateoutputpath = getCfgString(nameof(IntermediateOutputPath),  defaultIntermediatePath);
            intermediateoutputpath = AddSlash(intermediateoutputpath);
            documentationfile= getCfgLogic(nameof(DocumentationFile), false);
            optimize = getCfgLogic(nameof(Optimize),  false);
            usesharedcompilation = getCfgLogic(nameof(UseSharedCompilation),  true);
            prebuildevent = getCfgString(nameof(PreBuildEvent),"");
            postbuildevent = getCfgString(nameof(PostBuildEvent), "");
            string temp= "";
            temp = getCfgString(nameof(RunPostBuildEvent),  "Always");
            runpostbuildevent = (RunPostBuildEvent) new RunPostBuildEventConverter().ConvertFromString(temp);
            disabledwarnings = getCfgString(nameof(DisabledWarnings),  "");
            warningLevel= getCfgInteger(nameof(WarningLevel), 4);
            warningLevel = ValidateWarningLevel(warningLevel);
            warningAsErrors = getCfgLogic(nameof(TreatWarningsAsErrors), true);
            signassembly = getCfgLogic(nameof(SignAssembly), false);
            delaysign = getCfgLogic(nameof(DelaySign), false);
            assemblyoriginatorkeyfile = getCfgString(nameof(AssemblyOriginatorKeyFile), "");

            commandlineoption= getCfgString(nameof(CommandLineOption),  "");
            ppo = getCfgLogic(nameof(PPO),  false);
            nostddef = getCfgLogic(nameof(NoStdDef),  false);
            includepaths = getCfgString(nameof(IncludePaths),  "");
            defines = getCfgString(nameof(DefineConstants), "");
        }