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


C# DTE2.GetProject方法代码示例

本文整理汇总了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;
        }
开发者ID:cgoconseils,项目名称:XrmFramework,代码行数:14,代码来源:AssemblyLoader.cs

示例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");
        }
开发者ID:cgoconseils,项目名称:XrmFramework,代码行数:55,代码来源:MockGenerator.cs


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