C# VS多项目模板在创建新项目时创建一个额外文件夹
我创建了一个多项目自定义模板。这是我导出模板后的文件夹结构C# VS多项目模板在创建新项目时创建一个额外文件夹,c#,visual-studio,visual-studio-templates,C#,Visual Studio,Visual Studio Templates,我创建了一个多项目自定义模板。这是我导出模板后的文件夹结构 ServiceTemplate |_Template.Service |_MyTemplate.vstemplate |_Template.Service.Interface |_MyTemplate.vstemplate |_root.vstemplate 我压缩了“ServiceTemplate”下的所有文件和文件夹,它给了我“ServiceTemplate.zip” 我在“Visual Studio 2017\Te
ServiceTemplate
|_Template.Service
|_MyTemplate.vstemplate
|_Template.Service.Interface
|_MyTemplate.vstemplate
|_root.vstemplate
我压缩了“ServiceTemplate”下的所有文件和文件夹,它给了我“ServiceTemplate.zip”
我在“Visual Studio 2017\Templates\ProjectTemplates”下复制了该zip文件
我去了VisualStudio,用我的模板和解决方案(TestService)创建了一个新项目(Test.Service)
创建新项目时,我勾选了“创建解决方案文件夹”,但没有成功
<VSTemplate Version="3.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>Service Template</Name>
<Description></Description>
<ProjectType>CSharp</ProjectType>
<CreateNewFolder>false</CreateNewFolder>
</TemplateData>
<TemplateContent>
<ProjectCollection>
<ProjectTemplateLink ProjectName="$safeprojectname$" CopyParameters="true">
Template.Service\MyTemplate.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="$safeprojectname$.Interface" CopyParameters="true">
Template.Service.Interface\MyTemplate.vstemplate
</ProjectTemplateLink>
</ProjectCollection>
</TemplateContent>
</VSTemplate>
我在root.vstemplate中添加了false,但不起作用
<VSTemplate Version="3.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>Service Template</Name>
<Description></Description>
<ProjectType>CSharp</ProjectType>
<CreateNewFolder>false</CreateNewFolder>
</TemplateData>
<TemplateContent>
<ProjectCollection>
<ProjectTemplateLink ProjectName="$safeprojectname$" CopyParameters="true">
Template.Service\MyTemplate.vstemplate
</ProjectTemplateLink>
<ProjectTemplateLink ProjectName="$safeprojectname$.Interface" CopyParameters="true">
Template.Service.Interface\MyTemplate.vstemplate
</ProjectTemplateLink>
</ProjectCollection>
</TemplateContent>
</VSTemplate>
实际的
TestService
|_包裹
|_TestService.sln
|_TestService“我在创建新项目时勾选了“创建解决方案文件夹”选项“您是否尝试以其他方式创建项目?”?在正常情况下,选中该框会导致在项目上方的自己文件夹中创建解决方案。@Herohtar我创建解决方案时没有勾选该框,但问题仍然存在。“我在创建新项目时勾选了“创建解决方案文件夹”您是否尝试以其他方式创建该项目?在正常情况下,选中该框会导致在项目上方的文件夹中创建解决方案。@Herohtar我创建解决方案时没有勾选该框,但问题仍然存在。
TestService
|_packages
|_TestService.sln
|_TestService <--- (un-necessary folder)
|_Test.Service
|_Test.Service.csproj
|_Test.Service.Interface
|_Test.Service.Interface.csproj