本文整理汇总了C#中Microsoft.Build.Evaluation.Project.MarkDirty方法的典型用法代码示例。如果您正苦于以下问题:C# Project.MarkDirty方法的具体用法?C# Project.MarkDirty怎么用?C# Project.MarkDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Evaluation.Project
的用法示例。
在下文中一共展示了Project.MarkDirty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DirtyMarking2
public void DirtyMarking2 ()
{
string project_xml = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' />";
var xml = XmlReader.Create (new StringReader (project_xml));
var root = ProjectRootElement.Create (xml);
var proj = new Project (root);
proj.DisableMarkDirty = true;
proj.MarkDirty ();
Assert.IsFalse (proj.IsDirty, "#1"); // not rejected, just ignored.
proj.DisableMarkDirty = false;
Assert.IsFalse (proj.IsDirty, "#2"); // not like status pending
proj.MarkDirty ();
Assert.IsTrue (proj.IsDirty, "#3");
}
示例2: BuildEvaluationUsesCustomLoggers
public void BuildEvaluationUsesCustomLoggers()
{
string importProjectContent =
ObjectModelHelpers.CleanupFileContents(@"<Project xmlns='msbuildnamespace'>
</Project>");
string importFileName = Microsoft.Build.Shared.FileUtilities.GetTemporaryFile() + ".proj";
File.WriteAllText(importFileName, importProjectContent);
string projectContent =
ObjectModelHelpers.CleanupFileContents(@"<Project xmlns='msbuildnamespace'>
<Import Project=""" + importFileName + @"""/>
<Import Project=""" + importFileName + @"""/>
<ItemGroup>
<Compile Include='a.cs' />
</ItemGroup>
<Target Name=""Build"" />
</Project>");
Project project = new Project(XmlReader.Create(new StringReader(projectContent)));
project.MarkDirty();
MockLogger collectionLogger = new MockLogger();
project.ProjectCollection.RegisterLogger(collectionLogger);
MockLogger mockLogger = new MockLogger();
bool result;
try
{
result = project.Build(new ILogger[] { mockLogger });
}
catch
{
throw;
}
finally
{
project.ProjectCollection.UnregisterAllLoggers();
}
Assert.Equal(true, result);
Assert.Equal(0, mockLogger.WarningCount); // "Log should not contain MSB4011 because the build logger will not receive evaluation messages."
Assert.Equal(collectionLogger.Warnings[0].Code, "MSB4011"); // "Log should contain MSB4011 because the project collection logger should have been used for evaluation."
}
示例3: DirtyMarking
public void DirtyMarking ()
{
string project_xml = @"<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' />";
var xml = XmlReader.Create (new StringReader (project_xml));
var root = ProjectRootElement.Create (xml);
var proj = new Project (root);
Assert.IsFalse (proj.IsDirty, "#1");
proj.MarkDirty ();
Assert.IsTrue (proj.IsDirty, "#2");
}
示例4: ExternallyMarkDirty
public void ExternallyMarkDirty()
{
Project project = new Project();
project.SetProperty("p", "v");
project.ReevaluateIfNecessary();
Assert.Equal(false, project.IsDirty);
ProjectProperty property1 = project.GetProperty("p");
project.MarkDirty();
Assert.Equal(true, project.IsDirty);
project.ReevaluateIfNecessary();
Assert.Equal(false, project.IsDirty);
ProjectProperty property2 = project.GetProperty("p");
Assert.Equal(false, Object.ReferenceEquals(property1, property2)); // different object indicates reevaluation occurred
}