本文整理汇总了C#中Microsoft.Build.BuildEngine.Project.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetType方法的具体用法?C# Project.GetType怎么用?C# Project.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.BuildEngine.Project
的用法示例。
在下文中一共展示了Project.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupProject
Project SetupProject (ProjectConfigurationInfo[] configurations)
{
Project project = null;
foreach (var pc in configurations) {
var p = buildEngine.Engine.GetLoadedProject (pc.ProjectFile);
if (p == null) {
p = new Project (buildEngine.Engine);
var content = buildEngine.GetUnsavedProjectContent (pc.ProjectFile);
if (content == null)
p.Load (pc.ProjectFile);
else {
p.FullFileName = pc.ProjectFile;
if (HasXbuildFileBug ()) {
// Workaround for Xamarin bug #14295: Project.Load incorrectly resets the FullFileName property
var t = p.GetType ();
t.InvokeMember ("PushThisFileProperty", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, p, new object[] { p.FullFileName });
t.InvokeMember ("DoLoad", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, p, new object[] { new StringReader (content) });
} else {
p.Load (new StringReader (content));
}
}
}
p.GlobalProperties.SetProperty ("Configuration", pc.Configuration);
if (!string.IsNullOrEmpty (pc.Platform))
p.GlobalProperties.SetProperty ("Platform", pc.Platform);
else
p.GlobalProperties.RemoveProperty ("Platform");
if (pc.ProjectFile == file)
project = p;
}
Environment.CurrentDirectory = Path.GetDirectoryName (file);
return project;
}
示例2: SetupProject
Project SetupProject (ProjectConfigurationInfo[] configurations)
{
Project project = null;
var slnConfigContents = GenerateSolutionConfigurationContents (configurations);
foreach (var pc in configurations) {
var p = buildEngine.Engine.GetLoadedProject (pc.ProjectFile);
if (p != null && pc.ProjectFile == file) {
// building the project may create new items and/or modify some properties,
// so we always need to use a new instance of the project when building
buildEngine.Engine.UnloadProject (p);
p = null;
}
Environment.CurrentDirectory = Path.GetDirectoryName (Path.GetFullPath (file));
if (p == null) {
p = new Project (buildEngine.Engine);
var content = buildEngine.GetUnsavedProjectContent (pc.ProjectFile);
if (content == null) {
p.Load (pc.ProjectFile);
} else {
p.FullFileName = Path.GetFullPath (pc.ProjectFile);
if (HasXbuildFileBug ()) {
// Workaround for Xamarin bug #14295: Project.Load incorrectly resets the FullFileName property
var t = p.GetType ();
t.InvokeMember ("PushThisFileProperty", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, p, new object[] { p.FullFileName });
t.InvokeMember ("DoLoad", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, p, new object[] { new StringReader (content) });
} else {
p.Load (new StringReader (content));
}
}
}
p.GlobalProperties.SetProperty ("CurrentSolutionConfigurationContents", slnConfigContents);
p.GlobalProperties.SetProperty ("Configuration", pc.Configuration);
if (!string.IsNullOrEmpty (pc.Platform))
p.GlobalProperties.SetProperty ("Platform", pc.Platform);
else
p.GlobalProperties.RemoveProperty ("Platform");
if (pc.ProjectFile == file)
project = p;
}
Environment.CurrentDirectory = Path.GetDirectoryName (Path.GetFullPath (file));
return project;
}