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


C# Engine.GetType方法代码示例

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


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

示例1: CreateEngine

		private static Engine CreateEngine(FrameworkVersions toolsVersion, string frameworkPath)
        {
			Engine engine = new Engine(frameworkPath);

			Version fullVersion = engine.GetType().Assembly.GetName().Version;
			string version = fullVersion.ToString(2);
			if (toolsVersion == FrameworkVersions.v30 && version == "2.0")
				version = "3.0";//these use the same build runtime: 2.0/3.0
		    if (toolsVersion == FrameworkVersions.v45 && version == "4.0")
                version = "4.5";//these use the same build runtime: 4.0/4.5

			if (version.Replace(".", "") != toolsVersion.ToString().TrimStart('v'))
                throw new ApplicationException(String.Format("Expected runtime {0}, found ({1}){2}.", toolsVersion, version, fullVersion));

            Log.Verbose("Using build engine: {0}", engine.GetType().Assembly.FullName);

			if (toolsVersion == FrameworkVersions.v20 || toolsVersion == FrameworkVersions.v30)
				engine.GlobalProperties.SetProperty("MSBuildToolsPath", frameworkPath);

			//<property name="FrameworkSDKDir" value="%ProgramFiles%\Microsoft.NET\SDK\v2.0\" global="true"/>
			//if (!Directory.Exists(engine.GlobalProperties.SetProperty()))
			//{ }


            new MSBuildLog(engine);
            return engine;
        }
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:27,代码来源:BuildEngine.cs

示例2: MsVisitProjects

		void MsVisitProjects(VisitProject visitor)
		{
			Engine e = new Engine(RuntimeEnvironment.GetRuntimeDirectory());
            if(e.GetType().Assembly.GetName().Version.Major == 2)
				try { e.GlobalProperties.SetProperty("MSBuildToolsPath", RuntimeEnvironment.GetRuntimeDirectory()); }
				catch { }

			foreach (FileInfo file in _projects)
			{
				Project prj = new Project(e);
				try
				{
					prj.Load(file.FullName);
				}
				catch (Exception ex)
				{
					Console.Error.WriteLine("Unable to open project: {0}", file);
					Log.Verbose(ex.ToString());
					continue;
				}

				visitor(new MsBuildProject(prj));
				e.UnloadProject(prj);
			}
		}
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:25,代码来源:ProjectVisitor.cs

示例3: InitRuntime

        private string InitRuntime(string toolsVersion, string frameworkDir, bool hardReferences)
		{
			_items = new ItemLookup();
			_toolsVersion = toolsVersion;
			_engine = new Engine( frameworkDir );

			Log.Verbose("Using build engine: {0}", _engine.GetType().Assembly.FullName);
			string version = _engine.GetType().Assembly.GetName().Version.ToString(2);
			Is35 = version == "3.5";

            if (hardReferences)
            {
                _engine.GlobalProperties.SetProperty("AssemblySearchPaths", "{HintPathFromItem}");
                //{CandidateAssemblyFiles}
                //{HintPathFromItem}
                //{TargetFrameworkDirectory}
                //{Registry:Software\Microsoft\.NetFramework,v2.0,AssemblyFoldersEx}
                //{AssemblyFolders}
                //{GAC}
                //{RawFileName}
                //$(OutputPath)

                _engine.GlobalProperties.SetProperty("NoStdLib", true.ToString());
            }
			if( !Is35 )
				_engine.GlobalProperties.SetProperty("MSBuildToolsPath", frameworkDir);

			ConsoleLogger trace = new Microsoft.Build.BuildEngine.ConsoleLogger(
					LoggerVerbosity.Minimal, ConsoleWrite, ColorSetter, ColorResetter
				);
			trace.SkipProjectStartedText = false;
			trace.ShowSummary = false;
			_engine.RegisterLogger(trace);

			return version;
		}
开发者ID:hivie7510,项目名称:csharptest-net,代码行数:36,代码来源:BuildList.cs


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