本文整理汇总了C#中Microsoft.Build.Evaluation.Project.RemoveProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Project.RemoveProperty方法的具体用法?C# Project.RemoveProperty怎么用?C# Project.RemoveProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Evaluation.Project
的用法示例。
在下文中一共展示了Project.RemoveProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemovePropertyWithSibling
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);
}
示例2: BaseProjectProperty
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);
}
示例3: RemoveProperty
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);
}
示例4: BaseProjectProperty
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);
}