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


C# MSBuildProject.Evaluate方法代码示例

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


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

示例1: LoadAndEvaluate

		static MSBuildProject LoadAndEvaluate (string dir, string testFile)
		{
			string projectFile = Util.GetSampleProject (dir, testFile);
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();
			return p;
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:8,代码来源:MSBuildProjectTests.cs

示例2: OnReadProject

		protected override void OnReadProject (ProgressMonitor monitor, MSBuildProject msproject)
		{
			base.OnReadProject (monitor, msproject);

			var import = msproject.Imports.FirstOrDefault (im => im.Label == "Shared");
			if (import == null)
				return;

			// TODO: load the type from msbuild
			foreach (var item in msproject.Imports) {
				if (item.Project.Equals (CSharptargets, StringComparison.OrdinalIgnoreCase)) {
					LanguageName = "C#";
					break;
				}
				if (item.Project.Equals (FSharptargets, StringComparison.OrdinalIgnoreCase)) {
					LanguageName = "F#";
					break;
				}
			}
			//If for some reason the language name is empty default it to C#
			if (String.IsNullOrEmpty(LanguageName))
				LanguageName = "C#";

			projItemsPath = MSBuildProjectService.FromMSBuildPath (msproject.BaseDirectory, import.Project);

			MSBuildProject p = new MSBuildProject (msproject.EngineManager);
			p.Load (projItemsPath);
			p.Evaluate ();

			var cp = p.PropertyGroups.FirstOrDefault (g => g.Label == "Configuration");
			if (cp != null)
				DefaultNamespace = cp.GetValue ("Import_RootNamespace");

			LoadProjectItems (p, ProjectItemFlags.None, usedMSBuildItems);

			projitemsProject = p;
		}
开发者ID:PlayScriptRedux,项目名称:monodevelop,代码行数:37,代码来源:SharedAssetsProject.cs

示例3: ConditionedProperties

		public void ConditionedProperties ()
		{
			string projectFile = Util.GetSampleProject ("msbuild-tests", "conditioned-properties.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();

			Assert.That (new string [] { "cond1", "cond2", "cond9", "cond10", "cond13" }, Is.EquivalentTo (p.ConditionedProperties.GetAllProperties ().ToArray ()));

			Assert.That (new string [] { "val1", "val14_1", "val14_4", "val14_5" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond1").ToArray ()));

			Assert.That (new string [] { "val2_0", "val2_7", "val14_2", "val14_3", "val14_6" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond2").ToArray ()));

			Assert.That (new string [] { "val9" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond9").ToArray ()));

			Assert.That (new string [] { "val10_1", "val10_2" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond10").ToArray ()));

			Assert.That (new string [] { "val13_4" }, Is.EquivalentTo (p.ConditionedProperties.GetAllPropertyValues ("cond13").ToArray ()));

			// Combined values

			Assert.That (new [] {
				new ValueSet (new [] { "cond1" }, new [] { "val1" })
			}, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond1").ToArray ()));

			Assert.That (new [] {
				new ValueSet (new [] { "cond2" }, new [] { "val2_0" }),
				new ValueSet (new [] { "cond2" }, new [] { "val2_7" }),
			}, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond2").ToArray ()));

			Assert.That (new [] {
				new ValueSet (new [] { "cond9" }, new [] { "val9" }),
			}, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond9").ToArray ()));

			Assert.That (new [] {
				new ValueSet (new [] { "cond10" }, new [] { "val10_1" }),
				new ValueSet (new [] { "cond10" }, new [] { "val10_2" }),
			}, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond10").ToArray ()));

			Assert.That (new [] {
				new ValueSet (new [] { "cond13" }, new [] { "val13_4" }),
			}, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond13").ToArray ()));

			Assert.That (new [] {
				new ValueSet (new [] { "cond1", "cond2" }, new [] { "val14_1", "val14_2" }),
				new ValueSet (new [] { "cond1", "cond2" }, new [] { "val14_4", "val14_3" }),
				new ValueSet (new [] { "cond1", "cond2" }, new [] { "val14_5", "val14_6" }),
			}, Is.EquivalentTo (p.ConditionedProperties.GetCombinedPropertyValues ("cond1", "cond2").ToArray ()));
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:49,代码来源:MSBuildProjectTests.cs

示例4: EvalItemsAfterProperties

		public void EvalItemsAfterProperties ()
		{
			string projectFile = Util.GetSampleProject ("msbuild-tests", "property-eval-order.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();
			Assert.AreEqual (new [] {"Two"}, p.EvaluatedItems.Select (i => i.Include).ToArray ());
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:8,代码来源:MSBuildProjectTests.cs

示例5: FunctionProperties

		public void FunctionProperties ()
		{
			string projectFile = Util.GetSampleProject ("msbuild-tests", "functions.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();

			Assert.AreEqual ("bcd", p.EvaluatedProperties.GetValue ("Substring"));
			Assert.AreEqual ("ab", p.EvaluatedProperties.GetValue ("MethodWithParams1"));
			Assert.AreEqual ("abc", p.EvaluatedProperties.GetValue ("MethodWithParams2"));
			Assert.AreEqual ("abcd", p.EvaluatedProperties.GetValue ("MethodWithParams3"));
			Assert.AreEqual ("abcdefghij", p.EvaluatedProperties.GetValue ("MethodWithParams4"));
			Assert.AreEqual ("ab", p.EvaluatedProperties.GetValue ("MethodWithParams5"));
			Assert.AreEqual ("255", p.EvaluatedProperties.GetValue ("MaxByte"));
			Assert.AreEqual ("A", p.EvaluatedProperties.GetValue ("Upper1"));
			Assert.AreEqual ("a'b'c5", p.EvaluatedProperties.GetValue ("Upper2"));
			Assert.AreEqual ("a\"b\"c5", p.EvaluatedProperties.GetValue ("Upper3"));
			Assert.AreEqual ("abc5", p.EvaluatedProperties.GetValue ("Upper4"));
			Assert.AreEqual ("abcdefgh5", p.EvaluatedProperties.GetValue ("Upper5"));
			Assert.AreEqual ("1234567890", p.EvaluatedProperties.GetValue ("FileContent"));
			Assert.AreEqual ("00007fff", p.EvaluatedProperties.GetValue ("HexConv"));
			Assert.AreEqual ("[1234567890]", p.EvaluatedProperties.GetValue ("ConcatFileContent"));

			Assert.AreEqual ("5", p.EvaluatedProperties.GetValue ("MSBuildAdd"));
			Assert.AreEqual ("5.5", p.EvaluatedProperties.GetValue ("MSBuildAddDouble"));
			Assert.AreEqual ("abcdefgh", p.EvaluatedProperties.GetValue ("MSBuildValueOrDefault1"));
			Assert.AreEqual ("empty", p.EvaluatedProperties.GetValue ("MSBuildValueOrDefault2"));
			Assert.AreEqual ("a", p.EvaluatedProperties.GetValue ("CharTrim"));

			var dir = System.IO.Path.GetFullPath (System.IO.Path.Combine (System.IO.Path.GetDirectoryName (projectFile), "foo"));
			Assert.AreEqual (dir, p.EvaluatedProperties.GetValue ("FullPath"));
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:32,代码来源:MSBuildProjectTests.cs

示例6: ChooseElement

		public void ChooseElement ()
		{
			string projectFile = Util.GetSampleProject ("project-with-choose-element", "project.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();
			Assert.AreEqual ("One", p.EvaluatedProperties.GetValue ("Foo"));

			var pi = p.CreateInstance ();
			pi.SetGlobalProperty ("Configuration", "Release");
			pi.Evaluate ();
			Assert.AreEqual ("Two", pi.EvaluatedProperties.GetValue ("Foo"));

			pi.SetGlobalProperty ("Configuration", "Alt");
			pi.Evaluate ();
			Assert.AreEqual ("Three", pi.EvaluatedProperties.GetValue ("Foo"));
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:17,代码来源:MSBuildProjectTests.cs

示例7: ParseConditionWithoutQuotes

		public void ParseConditionWithoutQuotes ()
		{
			string projectFile = Util.GetSampleProject ("msbuild-tests", "condition-parse.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();
			Assert.AreEqual (new [] {"aa","vv","test"}, p.EvaluatedItems.Select (i => i.Include).ToArray ());
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:8,代码来源:MSBuildProjectTests.cs

示例8: ImportGroups

		public void ImportGroups ()
		{
			string projectFile = Util.GetSampleProject ("project-with-import-groups", "import-group-test.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();

			Assert.AreEqual ("v2", p.EvaluatedProperties.GetValue ("TestProp"));
			Assert.AreEqual ("one", p.EvaluatedProperties.GetValue ("PropFromTest1"));
			Assert.AreEqual ("two", p.EvaluatedProperties.GetValue ("PropFromTest2"));
			Assert.AreEqual ("three", p.EvaluatedProperties.GetValue ("PropFromFoo"));
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:12,代码来源:MSBuildProjectTests.cs

示例9: ImplicitImportOfUserProject

		public void ImplicitImportOfUserProject ()
		{
			string projectFile = Util.GetSampleProject ("msbuild-project-test", "test-user.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();
			Assert.AreEqual ("Bar", p.EvaluatedProperties.GetValue ("TestProp"));
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:8,代码来源:MSBuildProjectTests.cs

示例10: ParseConditionWithMethodInvoke

		public void ParseConditionWithMethodInvoke ()
		{
			// XBC 40008
			string projectFile = Util.GetSampleProject ("msbuild-tests", "condition-parse.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();
			Assert.AreEqual ("Foo", p.EvaluatedProperties.GetValue ("Test1"));
			Assert.AreEqual ("Bar", p.EvaluatedProperties.GetValue ("Test2"));
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:10,代码来源:MSBuildProjectTests.cs

示例11: StartWhitespaceForImportInsertedAsFirstChild

		public void StartWhitespaceForImportInsertedAsFirstChild ()
		{
			string projectFile = Util.GetSampleProject ("ConsoleApp-VS2013", "ConsoleApplication.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();
			var firstChild = p.GetAllObjects ().First ();

			MSBuildImport import = p.AddNewImport ("MyImport.targets", beforeObject: firstChild);

			Assert.AreEqual (p.TextFormat.NewLine, p.StartWhitespace);
			Assert.AreEqual ("  ", import.StartWhitespace);
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:13,代码来源:MSBuildProjectTests.cs

示例12: ConditionedProperties

		public void ConditionedProperties ()
		{
			string projectFile = Util.GetSampleProject ("msbuild-tests", "conditioned-properties.csproj");
			var p = new MSBuildProject ();
			p.Load (projectFile);
			p.Evaluate ();

			Assert.That (new string [] { "cond1", "cond2", "cond9", "cond10", "cond13"}, Is.EquivalentTo (p.ConditionedProperties.Keys.ToArray ()));

			Assert.That (new string [] { "val1"}, Is.EquivalentTo (p.ConditionedProperties["cond1"].ToArray ()));

			Assert.That (new string [] { "val2_0", "val2_7"}, Is.EquivalentTo (p.ConditionedProperties["cond2"].ToArray ()));

			Assert.That (new string [] { "val9"}, Is.EquivalentTo (p.ConditionedProperties["cond9"].ToArray ()));

			Assert.That (new string [] { "val10_1", "val10_2"}, Is.EquivalentTo (p.ConditionedProperties["cond10"].ToArray ()));

			Assert.That (new string [] { "val13_4"}, Is.EquivalentTo (p.ConditionedProperties["cond13"].ToArray ()));
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:19,代码来源:MSBuildProjectTests.cs


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