本文整理汇总了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;
}
示例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);
}
}
示例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;
}