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


C# Project.MarkDirty方法代码示例

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

示例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."
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:48,代码来源:Project_Tests.cs

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

示例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
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:22,代码来源:Project_Tests.cs


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