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


C# Project.RemoveGlobalProperty方法代码示例

本文整理汇总了C#中Microsoft.Build.Evaluation.Project.RemoveGlobalProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Project.RemoveGlobalProperty方法的具体用法?C# Project.RemoveGlobalProperty怎么用?C# Project.RemoveGlobalProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Build.Evaluation.Project的用法示例。


在下文中一共展示了Project.RemoveGlobalProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveGlobalProperties

        public void RemoveGlobalProperties()
        {
            Project project = new Project();
            ProjectPropertyElement propertyElement = project.Xml.AddProperty("p", "v0");
            propertyElement.Condition = "'$(g)'==''";
            project.SetGlobalProperty("g", "v1");
            project.ReevaluateIfNecessary();
            Assert.Equal(String.Empty, project.GetPropertyValue("p"));

            bool existed = project.RemoveGlobalProperty("g");
            Assert.Equal(true, existed);
            Assert.Equal(true, project.IsDirty);
            project.ReevaluateIfNecessary();
            Assert.Equal("v0", project.GetPropertyValue("p"));
            Assert.Equal(false, project.GlobalProperties.ContainsKey("g"));
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:16,代码来源:Project_Tests.cs

示例2: removeGlobalProperty

        /// <param name="project">Uses GlobalProjectCollection if null.</param>
        /// <param name="name"></param>
        /// <returns>Returns true if the value of the global property was set.</returns>
        protected virtual bool removeGlobalProperty(Project project, string name)
        {
            if(project == null) {
                return ProjectCollection.GlobalProjectCollection.RemoveGlobalProperty(name);
            }

            return project.RemoveGlobalProperty(name);
        }
开发者ID:3F,项目名称:vsCommandEvent,代码行数:11,代码来源:Parser.cs

示例3: RemoveNonExistentGlobalProperties

        public void RemoveNonExistentGlobalProperties()
        {
            Project project = new Project();
            bool existed = project.RemoveGlobalProperty("x");

            Assert.Equal(false, existed);
            Assert.Equal(false, project.IsDirty);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:8,代码来源:Project_Tests.cs

示例4: ProjectChangedEvent

        public void ProjectChangedEvent()
        {
            ProjectCollection collection = new ProjectCollection();
            ProjectRootElement pre = null;
            Project project = null;
            bool dirtyRaised = false;
            collection.ProjectChanged +=
                (sender, e) =>
                {
                    Assert.Same(collection, sender);
                    Assert.Same(project, e.Project);
                    dirtyRaised = true;
                };
            Assert.False(dirtyRaised);

            pre = ProjectRootElement.Create(collection);
            project = new Project(pre, null, null, collection);

            // all these should still pass with disableMarkDirty set
            collection.DisableMarkDirty = true;
            project.DisableMarkDirty = true;

            dirtyRaised = false;
            pre.AppendChild(pre.CreatePropertyGroupElement());
            Assert.False(dirtyRaised); // "Dirtying the XML directly should not result in a ProjectChanged event."

            // No events should be raised before we associate a filename with the PRE
            dirtyRaised = false;
            project.SetGlobalProperty("someGlobal", "someValue");
            Assert.False(dirtyRaised);

            dirtyRaised = false;
            project.SetProperty("someProp", "someValue");
            Assert.False(dirtyRaised);

            pre.FullPath = FileUtilities.GetTemporaryFile();
            dirtyRaised = false;
            project.SetGlobalProperty("someGlobal", "someValue2");
            Assert.True(dirtyRaised);

            dirtyRaised = false;
            project.RemoveGlobalProperty("someGlobal");
            Assert.True(dirtyRaised);

            dirtyRaised = false;
            collection.SetGlobalProperty("somePCglobal", "someValue");
            Assert.True(dirtyRaised);

            dirtyRaised = false;
            project.SetProperty("someProp", "someValue2");
            Assert.True(dirtyRaised);
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:52,代码来源:ProjectCollection_Tests.cs


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