提交 0162e66e 编写于 作者: T Tanner Gooding

Updating the Roslyn.VisualStudio.Test.Utilities to not conflict for the...

Updating the Roslyn.VisualStudio.Test.Utilities to not conflict for the WellKnownProjectTemplate.ConsoleApplication
上级 3117d0e7
......@@ -12,7 +12,8 @@ internal class SolutionExplorer_InProc : InProcComponent
private EnvDTE80.Solution2 _solution;
private string _fileName;
private static readonly IDictionary<string, string> _projectTemplates = InitializeProjectTemplates();
private static readonly IDictionary<string, string> _csharpProjectTemplates = InitializeCSharpProjectTemplates();
private static readonly IDictionary<string, string> _visualBasicProjectTemplates = InitializeVisualBasicProjectTemplates();
private SolutionExplorer_InProc() { }
......@@ -21,14 +22,29 @@ public static SolutionExplorer_InProc Create()
return new SolutionExplorer_InProc();
}
private static IDictionary<string, string> InitializeProjectTemplates()
private static IDictionary<string, string> InitializeCSharpProjectTemplates()
{
var localeID = GetDTE().LocaleID;
return new Dictionary<string, string>
{
[WellKnownProjectTemplates.ClassLibrary] = $@"Windows\{localeID}\ClassLibrary.zip",
[WellKnownProjectTemplates.ConsoleApplication] = "ConsoleApplication.zip",
[WellKnownProjectTemplates.ConsoleApplication] = "Microsoft.CSharp.ConsoleApplication",
[WellKnownProjectTemplates.Website] = "EmptyWeb.zip",
[WellKnownProjectTemplates.WinFormsApplication] = "WindowsApplication.zip",
[WellKnownProjectTemplates.WpfApplication] = "WpfApplication.zip",
[WellKnownProjectTemplates.WebApplication] = "WebApplicationProject40"
};
}
private static IDictionary<string, string> InitializeVisualBasicProjectTemplates()
{
var localeID = GetDTE().LocaleID;
return new Dictionary<string, string>
{
[WellKnownProjectTemplates.ClassLibrary] = $@"Windows\{localeID}\ClassLibrary.zip",
[WellKnownProjectTemplates.ConsoleApplication] = "Microsoft.VisualBasic.Windows.ConsoleApplication",
[WellKnownProjectTemplates.Website] = "EmptyWeb.zip",
[WellKnownProjectTemplates.WinFormsApplication] = "WindowsApplication.zip",
[WellKnownProjectTemplates.WpfApplication] = "WpfApplication.zip",
......@@ -122,7 +138,36 @@ public void AddProject(string projectName, string projectTemplate, string langua
// 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);
var projectTemplateName = string.Empty;
switch (languageName.ToLower())
{
case "csharp":
{
if (_csharpProjectTemplates.TryGetValue(projectTemplate, out projectTemplateName))
{
break;
}
goto default;
}
case "visualbasic":
{
if (_visualBasicProjectTemplates.TryGetValue(projectTemplate, out projectTemplateName))
{
break;
}
goto default;
}
default:
{
projectTemplateName = projectTemplate;
break;
}
}
return _solution.GetProjectTemplate(projectTemplateName, languageName);
}
public void CleanUpOpenSolution()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册