本文整理汇总了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"));
}
示例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);
}
示例3: RemoveNonExistentGlobalProperties
public void RemoveNonExistentGlobalProperties()
{
Project project = new Project();
bool existed = project.RemoveGlobalProperty("x");
Assert.Equal(false, existed);
Assert.Equal(false, project.IsDirty);
}
示例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);
}