GetMsBuildProperty() private method

private GetMsBuildProperty ( string propertyName, bool resetCache ) : Microsoft.Build.Execution.ProjectPropertyInstance
propertyName string
resetCache bool
return Microsoft.Build.Execution.ProjectPropertyInstance
Esempio n. 1
0
        private string GetPerConfigValue(MSBuild.Project buildProject, bool finalValue, IList <ProjectConfig> configs, bool nullIsFalse)
        {
            string unifiedValue = null;

            for (int i = 0; i < configs.Count; i++)
            {
                ProjectConfig config     = configs[i];
                bool          resetCache = (i == 0);

                // we should be using the buildProject parameter here, but this isn't implemented in MPF
                MSBuild.ProjectProperty buildProperty = config.GetMsBuildProperty(this.propertyName, resetCache);
                string value = this.GetBuildPropertyValue(buildProperty, finalValue);

                if (value != null)
                {
                    value = value.Trim();
                }

                if (nullIsFalse && String.IsNullOrEmpty(value))
                {
                    value = Boolean.FalseString;
                }

                if (i == 0)
                {
                    unifiedValue = value;
                }
                else if (unifiedValue != value)
                {
                    unifiedValue = null; // indicates indeterminate value
                    break;
                }
            }

            return(unifiedValue);
        }