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


C# Engine.CreateNewProject方法代码示例

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


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

示例1: TestExecution1

		public void TestExecution1 ()
		{
			Engine engine;
			Project project;

			string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<Target Name='1'>
						<GetFrameworkPath>
							<Output
								TaskParameter='Path'
								PropertyName='Path'
							/>
						</GetFrameworkPath>
					</Target>
				</Project>
			";

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.LoadXml (documentString);
			Assert.IsTrue (project.Build ("1"), "A1");

			Assert.IsNotNull (project.EvaluatedProperties ["Path"], "A2");
			Assert.IsTrue (String.Empty != project.EvaluatedProperties ["Path"].FinalValue, "A3");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:26,代码来源:GetFrameworkPathTest.cs

示例2: TestCondition1

		public void TestCondition1 ()
		{
			Engine engine = new Engine (Consts.BinPath);
			Project proj = engine.CreateNewProject ();

			string documentString = @"
				<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<PropertyGroup>
						<A Condition='true'></A>
						<B Condition='false'></B>
						<C Condition='TRUE'></C>
						<D Condition='FALSE'></D>
						<E Condition=''>A</E>
					</PropertyGroup>
				</Project>
			";

			proj.LoadXml (documentString);

			Assert.IsNotNull (proj.EvaluatedProperties ["A"], "A1");
			Assert.IsNull (proj.EvaluatedProperties ["B"], "A2");
			Assert.IsNotNull (proj.EvaluatedProperties ["C"], "A3");
			Assert.IsNull (proj.EvaluatedProperties ["D"], "A4");
			Assert.IsNotNull (proj.EvaluatedProperties ["E"], "A5");
		}
开发者ID:GuySrinivasan,项目名称:mono,代码行数:25,代码来源:Conditions.cs

示例3: TestAssemblyFile2

		public void TestAssemblyFile2 ()
		{
			string documentString = @"
				<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<UsingTask
						AssemblyFile='Test/resources/TestTasks.dll'
						TaskName='SimpleTask'
					/>
				</Project>
			";

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.LoadXml (documentString);
			
			IEnumerator en = project.UsingTasks.GetEnumerator ();
			en.MoveNext ();
			
			UsingTask ut = (UsingTask) en.Current;
			
			Assert.AreEqual ("Test/resources/TestTasks.dll", ut.AssemblyFile, "A1");
			Assert.IsNull (ut.AssemblyName, "A2");
			Assert.AreEqual (null, ut.Condition, "A3");
			Assert.AreEqual (false, ut.IsImported, "A4");
			Assert.AreEqual ("SimpleTask", ut.TaskName, "A5");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:26,代码来源:UsingTaskTest.cs

示例4: TestGetEnumerator

		public void TestGetEnumerator ()
		{
			string documentString = @"
				<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<UsingTask
						AssemblyFile='Test/resources/TestTasks.dll'
						TaskName='TrueTestTask'
					/>
					<UsingTask
						AssemblyFile='Test/resources/TestTasks.dll'
						TaskName='FalseTestTask'
					/>
				</Project>
			";

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.LoadXml (documentString);
			
			IEnumerator en = project.UsingTasks.GetEnumerator ();
			en.MoveNext ();

			Assert.AreEqual ("Test/resources/TestTasks.dll", ((UsingTask) en.Current).AssemblyFile, "A1");
			Assert.AreEqual ("TrueTestTask", ((UsingTask) en.Current).TaskName, "A2");

			en.MoveNext ();

			Assert.AreEqual ("Test/resources/TestTasks.dll", ((UsingTask) en.Current).AssemblyFile, "A3");
			Assert.AreEqual ("FalseTestTask", ((UsingTask) en.Current).TaskName, "A4");

			Assert.IsFalse (en.MoveNext ());
		}
开发者ID:nlhepler,项目名称:mono,代码行数:32,代码来源:UsingTaskCollectionTest.cs

示例5: TestFalseWhen

        public void TestFalseWhen () {
            Engine engine;
            Project project;
            BuildItemGroup[] groups = new BuildItemGroup[1];

            string documentString = @"
				<Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
                    <Choose>
                        <When Condition=""'$(Configuration)' == 'False'"">
					        <ItemGroup>
						        <A Include='a' />
					        </ItemGroup>
                        </When>
                    </Choose>
				</Project>
			";

            engine = new Engine (Consts.BinPath);
            project = engine.CreateNewProject ();
            project.LoadXml (documentString);

            //Assert.AreEqual (1, project.ItemGroups.Count, "A1");
            Assert.AreEqual (0, project.PropertyGroups.Count, "A2");
            Assert.AreEqual (0, project.EvaluatedItems.Count, "A3");
            Assert.AreEqual (0, project.EvaluatedItemsIgnoringCondition.Count, "A4");
        }
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:26,代码来源:BuildChooseTest.cs

示例6: TestFromXml2

		public void TestFromXml2 ()
		{
                        string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<Target Name='Target' Condition='false' DependsOnTargets='X' >
					</Target>
                                </Project>
                        ";

			engine = new Engine (Consts.BinPath);

                        project = engine.CreateNewProject ();
                        project.LoadXml (documentString);

			Target[] t = new Target [1];
			project.Targets.CopyTo (t, 0);

			Assert.AreEqual ("false", t [0].Condition, "A1");
			Assert.AreEqual ("X", t [0].DependsOnTargets, "A2");

			t [0].Condition = "true";
			t [0].DependsOnTargets = "A;B";

			Assert.AreEqual ("true", t [0].Condition, "A3");
			Assert.AreEqual ("A;B", t [0].DependsOnTargets, "A4");
		}
开发者ID:ancailliau,项目名称:mono,代码行数:26,代码来源:TargetTest.cs

示例7: TestProperties2

		public void TestProperties2 ()
		{
			Engine engine = new Engine (Consts.BinPath);
			Project proj = engine.CreateNewProject ();

			string documentString = @"
				<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<UsingTask TaskName='StringTestTask' AssemblyFile='Test\resources\TestTasks.dll' />
					<PropertyGroup>
						<A>A</A>
						<B>B</B>
					</PropertyGroup>

					<Target Name='Main' >
						<StringTestTask Array='$(A)$(B)'>
							<Output TaskParameter='Array' ItemName='Out' />
						</StringTestTask>
					</Target>
				</Project>
			";

			proj.LoadXml (documentString);
			proj.Build ("Main");
			Assert.AreEqual (1, proj.GetEvaluatedItemsByName ("Out").Count, "A1");
			Assert.AreEqual ("AB", proj.GetEvaluatedItemsByName ("Out") [0].Include, "A2");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:26,代码来源:Properties.cs

示例8: TestExecution1

		public void TestExecution1 ()
		{
			Engine engine;
			Project project;

			string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<ItemGroup>
						<Dir Include='b' />
						<Dir Include='c' />
						<Dir Include='d\e' />
					</ItemGroup>
					<Target Name='1'>
						<CombinePath BasePath='a' Paths='@(Dir)'>
							<Output
								TaskParameter='CombinedPaths'
								ItemName='Out'
							/>
						</CombinePath>
					</Target>
				</Project>
			";

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.LoadXml (documentString);
			Assert.IsTrue (project.Build ("1"), "A1");

			BuildItemGroup output = project.GetEvaluatedItemsByName ("Out");
			Assert.AreEqual (3, output.Count, "A2");
			Assert.AreEqual (Path.Combine ("a", "b"), output [0].FinalItemSpec, "A3");
			Assert.AreEqual (Path.Combine ("a", "c"), output [1].FinalItemSpec, "A4");
			Assert.AreEqual (Path.Combine ("a", Path.Combine ("d", "e")), output [2].FinalItemSpec, "A5");

		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:35,代码来源:CombinePathTest.cs

示例9: TestItems1

		public void TestItems1 ()
		{
			Engine engine = new Engine (Consts.BinPath);
			Project proj = engine.CreateNewProject ();

			string documentString = @"
				<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<ItemGroup>
						<Item0 Include='A' />
						<Item1 Include='A;B;C' />
						<Item2 Include='@(Item1);A;D' />
						<Item3 Include='@(Item2)' Exclude='A' />
						<Item4 Include='@(Item1);Q' Exclude='@(Item2)' />
						<Item5 Include='@(Item1)' Exclude='@(Item2)' />
						<Item6 Include='@(Item2)' Exclude='@(Item1)' />
						<Item7 Include='@(item_that_doesnt_exist)' />
					</ItemGroup>
				</Project>
			";

			proj.LoadXml (documentString);
			CheckItems (proj, "Item0", "A1", "A");
			CheckItems (proj, "Item1", "A2", "A", "B", "C");
			CheckItems (proj, "Item2", "A3", "A", "B", "C", "A", "D");
			CheckItems (proj, "Item3", "A4", "B", "C", "D");
			CheckItems (proj, "Item4", "A5", "Q");
			CheckItems (proj, "Item5", "A6");
			CheckItems (proj, "Item6", "A7", "D");
			CheckItems (proj, "Item7", "A8");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:30,代码来源:Items.cs

示例10: TestAddNewProperty2

		public void TestAddNewProperty2 ()
		{
			Engine engine;
			Project project;

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();

			project.EvaluatedProperties.AddNewProperty ("a", "b");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:BuildPropertyGroupTest.cs

示例11: TestHintPath1

		public void TestHintPath1 ()
		{
			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.LoadXml (ResolveAssembly (null, @"Test\resources\test.dll"));
			
			Assert.IsTrue (project.Build ("A"), "A1");
			big = project.GetEvaluatedItemsByName ("ResolvedFiles");
			Assert.AreEqual (1, big.Count, "A2");
			Assert.IsTrue (big [0].Include.EndsWith (".dll"), "A3");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:11,代码来源:ResolveAssemblyReferenceTest.cs

示例12: TestAdd1

		public void TestAdd1 ()
		{
                        string documentString = @"
                                <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
					<Import Project='project_that_doesnt_exist'/>
                                </Project>
                        ";

                        engine = new Engine (Consts.BinPath);

                        project = engine.CreateNewProject ();
                        project.LoadXml (documentString);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:ImportCollectionTest.cs

示例13: TestRootElement

		public void TestRootElement ()
		{
			Engine engine;
			Project proj;
			string documentString = @"
			<something>
			</something>
			";

			engine = new Engine (Consts.BinPath);
			proj = engine.CreateNewProject ();
			proj.LoadXml (documentString);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:ProjectElement.cs

示例14: ResolveBinary_FancyStuff

		public void ResolveBinary_FancyStuff ()
		{
			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.LoadXml (ResolveAssembly (null, @"Test\resources\binary\FancyStuff.dll"));
			
			Assert.IsTrue (project.Build ("A"), "A1");
			big = project.GetEvaluatedItemsByName ("ResolvedFiles");
			Assert.AreEqual (1, big.Count, "A2");
			Assert.IsTrue (big[0].Include.EndsWith ("FancyStuff.dll"), "A3");
			
			big = project.GetEvaluatedItemsByName ("ResolvedDependencyFiles");
			Assert.AreEqual (1, big.Count, "A4");
			Assert.IsTrue (big.Cast<BuildItem> ().Any (item => item.Include.EndsWith ("SimpleWrite.dll")), "A5");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:ResolveAssemblyReferenceTest.cs

示例15: TestGac1

		public void TestGac1 ()
		{
			var gacDir = GetGacDir ();

			if (gacDir == null || !System.IO.Directory.Exists (gacDir))
				Assert.Ignore ("GAC not found.");

			engine = new Engine (Consts.BinPath);
			project = engine.CreateNewProject ();
			project.LoadXml (ResolveAssembly ("System", null));
			
			Assert.IsTrue (project.Build ("A"), "A1");
			big = project.GetEvaluatedItemsByName ("ResolvedFiles");
			Assert.AreEqual (1, big.Count, "A2");
			Assert.IsTrue (big [0].Include.EndsWith (".dll"), "A3");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:16,代码来源:ResolveAssemblyReferenceTest.cs


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