Web类别中的Visual Studio项目模板

时间:2013-06-20 12:08:08

标签: .net visual-studio templates vsix visual-studio-templates

我创建了一个引用VSIX Project的{​​{1}}(使用Visual Studio Extensibility);它看起来像这样:

C# Project Template

一切都按预期工作,但我的<TemplateData> <Name>...</Name> <Description>...</Description> <Icon>...</Icon> <ProjectType>Web</ProjectType> <ProjectSubType>CSharp</ProjectSubType> <TemplateGroupID>Web</TemplateGroupID> <DefaultName>WebApplication</DefaultName> </TemplateData> <TemplateContent> <ProjectCollection> <ProjectTemplateLink ProjectName="My Web Application"> Projects\WebApplication\ProjectTemplate.vstemplate </ProjectTemplateLink> <ProjectTemplateLink ProjectName="My Windows Library"> Projects\Library\ProjectTemplate.vstemplate </ProjectTemplateLink> </ProjectCollection> </TemplateContent> 始终显示在Visual Studio Project Template表单的默认Visual C#根类别中。

我想将它放在New Project

enter image description here

注意:

Web category

=&GT;

时,模板显示在默认的根类别中
<ProjectType>CSharp</ProjectType>
<ProjectSubType>Web</ProjectSubType>

=&GT;模板不可见!

2 个答案:

答案 0 :(得分:12)

您需要在Visual Studio解决方案资源管理器中设置.vstemplate文件的“类别”属性。

enter image description here

答案 1 :(得分:3)

如果手动创建项目模板(创建包含项目模板的* .zip文件)而不是通过visual studio中的可扩展性解决方案,子类别取决于放置项目模板包的文件系统的位置。 (该类别仍取决于.vstemplate中的ProjectType元素。)

例如,如果您创建一个zip文件,其中.vstemplate ProjectType的值为&#34; CSharp&#34;然后将zip文件放在(对于vs 2010):

"%USERPROFILE%\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\MySubcategory1\MySubcategory2

然后项目将出现在Visual C#下(由于ProjectType),然后出现在&#34; MySubcategory1 \ MySubcategory2&#34;层次结构(由于文件系统中的位置)

Project Type Subcategories

请注意,项目模板将出现在相同层次结构(Visual C# - MySubcategory1 - MySubcategory2)中,即使zip文件未放置在templates文件夹中的Visual C#子文件夹下,如下所示:

"%USERPROFILE%\Documents\Visual Studio 2010\Templates\ProjectTemplates\MySubcategory1\MySubcategory2