Esempio n. 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 virtual void SetProperty(string propertyName, string value)
        {
            ProjectProperty property = new ProjectProperty(this.ProjectMgr, propertyName);

            string oldValue = this.GetProperty(propertyName);

            if (!String.Equals(value, oldValue, StringComparison.Ordinal))
            {
                property.SetValue(value, projectConfigs);
                this.IsDirty = true;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets a property value as a tri-state checkbox value.
        /// </summary>
        /// <param name="propertyName">Name of the property to get.</param>
        /// <returns>Boolean check state, or Indeterminate if the property is
        /// inconsistent across configurations.</returns>
        public virtual CheckState GetPropertyCheckState(string propertyName)
        {
            ProjectProperty property = new ProjectProperty(this.ProjectMgr, propertyName);
            bool?           value    = property.GetBooleanValue(projectConfigs);

            if (!value.HasValue)
            {
                return(CheckState.Indeterminate);
            }
            else
            {
                return(value.Value ? CheckState.Checked : CheckState.Unchecked);
            }
        }
Esempio n. 3
0
 public static bool ThreadSafeRemoveProperty(this Microsoft.Build.Evaluation.Project thisp, ProjectProperty property)
 {
     lock (thisp)
     {
         return(thisp.RemoveProperty(property));
     }
 }
Esempio n. 4
0
        // =========================================================================================
        // Public 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 virtual string GetProperty(string propertyName)
        {
            ProjectProperty property = new ProjectProperty(this.ProjectMgr, propertyName);

            return(property.GetValue(false, projectConfigs));
        }