/// <summary> /// If the project support VsTemplates, returns the path to /// the vstemplate file corresponding to the requested template /// /// You can pass in a string such as: "Windows\Console Application" /// </summary> /*internal, but public for FSharp.Project.dll*/ public string GetVsTemplateFile(string templateFile) { // First see if this use the vstemplate model if (!String.IsNullOrEmpty(DefaultProjectExtensionValue)) { EnvDTE80.DTE2 dte = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2; if (dte != null) { EnvDTE80.Solution2 solution = dte.Solution as EnvDTE80.Solution2; if (solution != null) { string fullPath = solution.GetProjectTemplate(templateFile, DefaultProjectExtensionValue); // The path returned by GetProjectTemplate can be in the format "path|FrameworkVersion=x.y|Language=xxx" // where the framework version and language sections are optional. // Here we are interested only in the full path, so we have to remove all the other sections. int pipePos = fullPath.IndexOf('|'); if (0 == pipePos) { return(null); } if (pipePos > 0) { fullPath = fullPath.Substring(0, pipePos); } return(fullPath); } } } return(null); }
// TODO: Adjust language name based on whether we are using a web template private string GetProjectTemplatePath(string projectTemplate, string languageName) { string csharpProjectTemplate; if (languageName.Equals("csharp", StringComparison.OrdinalIgnoreCase) && _csharpProjectTemplates.TryGetValue(projectTemplate, out csharpProjectTemplate)) { return(_solution.GetProjectTemplate(csharpProjectTemplate, languageName)); } string visualBasicProjectTemplate; if (languageName.Equals("visualbasic", StringComparison.OrdinalIgnoreCase) && _visualBasicProjectTemplates.TryGetValue(projectTemplate, out visualBasicProjectTemplate)) { return(_solution.GetProjectTemplate(visualBasicProjectTemplate, languageName)); } return(_solution.GetProjectTemplate(projectTemplate, languageName)); }
/// <summary> /// If the project support VsTemplates, returns the path to /// the vstemplate file corresponding to the requested template /// /// You can pass in a string such as: "Windows\Console Application" /// </summary> internal string GetVsTemplateFile(string templateFile) { // First see if this use the vstemplate model if (!String.IsNullOrEmpty(DefaultProjectExtensionValue)) { EnvDTE80.DTE2 dte = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2; if (dte != null) { EnvDTE80.Solution2 solution = dte.Solution as EnvDTE80.Solution2; if (solution != null) { return(solution.GetProjectTemplate(templateFile, DefaultProjectExtensionValue)); } } } return(null); }
// TODO: Adjust language name based on whether we are using a web template private string GetProjectTemplatePath(ProjectTemplate projectTemplate, ProjectLanguage projectLanguage) => IntegrationHelper.RetryRpcCall(() => _dteSolution.GetProjectTemplate(_projectTemplates[projectTemplate], ProjectLanguages[projectLanguage]));
// TODO: Adjust language name based on whether we are using a web template private string GetProjectTemplatePath(ProjectTemplate projectTemplate, ProjectLanguage projectLanguage) => _dteSolution.GetProjectTemplate(ProjectTemplateName[projectTemplate], ProjectLanguageName[projectLanguage]);
// TODO: Adjust language name based on whether we are using a web template private string GetProjectTemplatePath(string projectTemplate, string languageName) { return(_solution.GetProjectTemplate(_projectTemplates[projectTemplate], languageName)); }