当前位置: 首页>>代码示例>>C#>>正文


C# Project.RemoveProperty方法代码示例

本文整理汇总了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);
        }
开发者ID:cdmihai,项目名称:msbuild,代码行数:18,代码来源:DefinitionEditing_Tests.cs

示例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);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:ProjectProperty.cs

示例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);
        }
开发者ID:cdmihai,项目名称:msbuild,代码行数:19,代码来源:DefinitionEditing_Tests.cs

示例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);
		}
开发者ID:GirlD,项目名称:mono,代码行数:9,代码来源:ProjectProperty.cs


注:本文中的Microsoft.Build.Evaluation.Project.RemoveProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。