public static bool ThreadSafeRemoveProperty(this Microsoft.Build.Evaluation.Project thisp, ProjectProperty property)
 {
     lock (thisp)
     {
         return(thisp.RemoveProperty(property));
     }
 }
Exemple #2
0
 public BaseProjectProperty(Project project, PropertyType propertyType, string name)
     : base(project)
 {
     property_type = propertyType;
     this.name     = name;
     predecessor   = project.Properties.FirstOrDefault(p => p.Name == name);
     if (predecessor != null)
     {
         project.RemoveProperty(predecessor);
     }
 }
Exemple #3
0
 public BaseProjectProperty(Project project, PropertyType propertyType, string name)
     : base(project)
 {
     property_type = propertyType;
     this.name     = name;
     predecessor   = project.Properties.FirstOrDefault(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
     if (predecessor != null)
     {
         project.RemoveProperty(predecessor);
     }
 }
        public void RemovePropertyWithSibling()
        {
            Project project = new Project();
            project.SetProperty("p1", "v1");
            project.SetProperty("p2", "v2");
            project.ReevaluateIfNecessary();

            project.RemoveProperty(project.GetProperty("p1"));

            string expected = ObjectModelHelpers.CleanupFileContents(
@"<Project ToolsVersion=""msbuilddefaulttoolsversion"" xmlns=""msbuildnamespace"">
  <PropertyGroup>
    <p2>v2</p2>
  </PropertyGroup>
</Project>");

            Helpers.VerifyAssertProjectContent(expected, project.Xml);
        }
        public void RemoveProperty()
        {
            Project project = new Project();
            int environmentPropertyCount = Helpers.MakeList(project.Properties).Count;

            project.SetProperty("p1", "v1");
            project.ReevaluateIfNecessary();

            project.RemoveProperty(project.GetProperty("p1"));

            string expected = ObjectModelHelpers.CleanupFileContents(@"<Project ToolsVersion=""msbuilddefaulttoolsversion"" xmlns=""msbuildnamespace"" />");

            Helpers.VerifyAssertProjectContent(expected, project.Xml);

            Assert.Equal(null, project.GetProperty("p1"));
            ProjectInstance instance = project.CreateProjectInstance();
            Assert.Equal(String.Empty, instance.GetPropertyValue("p1"));
            Assert.Equal(0, Helpers.Count(project.Properties) - environmentPropertyCount);
        }
Exemple #6
0
		public BaseProjectProperty (Project project, PropertyType propertyType, string name)
			: base (project)
		{
			property_type = propertyType;
			this.name = name;
			predecessor = project.Properties.FirstOrDefault (p => p.Name.Equals (name, StringComparison.OrdinalIgnoreCase));
			if (predecessor != null)
				project.RemoveProperty (predecessor);
		}
Exemple #7
0
		public BaseProjectProperty (Project project, PropertyType propertyType, string name)
			: base (project)
		{
			property_type = propertyType;
			this.name = name;
			predecessor = project.Properties.FirstOrDefault (p => p.Name == name);
			if (predecessor != null)
				project.RemoveProperty (predecessor);
		}