本文整理汇总了C#中DTE2.GetProject方法的典型用法代码示例。如果您正苦于以下问题:C# DTE2.GetProject方法的具体用法?C# DTE2.GetProject怎么用?C# DTE2.GetProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DTE2
的用法示例。
在下文中一共展示了DTE2.GetProject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAssemblyDirectory
private static DirectoryInfo GetAssemblyDirectory(DTE2 dte, string projectName)
{
var project = dte.GetProject(projectName);
if (project == null)
{
throw new Exception(string.Format(CultureInfo.CurrentCulture, "Project {0} not found", projectName));
}
var projectFileInfo = new FileInfo(project.FullName);
var dllDirectory = new DirectoryInfo(Path.Combine(projectFileInfo.Directory.FullName, "bin", dte.Solution.SolutionBuild.ActiveConfiguration.Name));
return dllDirectory;
}
示例2: GenerateMocks
public static void GenerateMocks(DTE2 dte)
{
var modelProject = dte.GetProject(ProjectNames.Model);
if (!modelProject.Build()) {
return;
}
var modelAssembly = modelProject.GetAssembly();
var iServiceType = modelAssembly.GetType("Plugins.IService");
var services = modelAssembly.GetTypes().Where(t => iServiceType.IsAssignableFrom(t) && t.IsInterface);
foreach (var serviceType in services)
{
}
//string mockBasePath = Path.GetDirectoryName(pluginCheckinProjFileName);
//string logServicePath = Path.GetDirectoryName(serviceUtilsProjFileName);
//var filesMock = new List<TfsHelper.FileInfo>();
//var filesMockTests = new List<TfsHelper.FileInfo>();
//var filesServices = new List<TfsHelper.FileInfo>();
//var filesLoggedServices = new List<TfsHelper.FileInfo>();
//filesMock.Add(new TfsHelper.FileInfo(GenerateMockFile(mockBasePath, typeof(IOrganizationService), false)));
//filesMockTests.Add(new TfsHelper.FileInfo(GenerateTestFile(mockBasePath, typeof(IOrganizationService), false)));
//foreach (var type in types)
//{
// filesMock.Add(new TfsHelper.FileInfo(GenerateMockFile(mockBasePath, type, true)));
// filesMockTests.Add(new TfsHelper.FileInfo(GenerateTestFile(mockBasePath, type, true)));
// foreach (var f in GenerateLogServiceFile(logServicePath, type, nullableAttributeType))
// {
// filesLoggedServices.Add(new TfsHelper.FileInfo(f));
// }
// if (type.Name != "IService")
// {
// filesServices.Add(new TfsHelper.FileInfo(type.Name + ".cs"));
// filesServices.Add(new TfsHelper.FileInfo(type.Name.Substring(1) + ".cs"));
// }
//}
//for (var i = 0; i < filesMock.Count; i++)
//{
// filesMockTests.Add(new TfsHelper.FileInfo(Path.Combine("Services", filesMock[i].NewName)));
//}
//TfsHelper.EnsureReferencesInProjectFile(pluginCheckinProjFileName, filesMockTests, @"Mocks\", null);
//TfsHelper.EnsureReferencesInProjectFile(serviceUtilsProjFileName, filesLoggedServices, "", null);
//TfsHelper.EnsureReferencesInProjectFile(pluginProjFileName, filesLoggedServices, @"..\Services.Utils\", @"Services");
//TfsHelper.EnsureReferencesInProjectFile(pluginProjFileName, filesServices, @"..\Model\Services", @"Services");
}