8

I created a VSIX Project (using Visual Studio Extensibility) that references a C# Project Template; it looks like this:

<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>

Everything works as expected, but my Project Template appears always in the default Visual C# root category of the Visual Studio New Project form.

I would like to have it inside the Web category.

enter image description here

Note:

<ProjectType>CSharp</ProjectType>
<ProjectSubType>Web</ProjectSubType>

=> The template appears in the default root category while

<ProjectType>Web</ProjectType>
<ProjectSubType>CSharp</ProjectSubType>

=> The Template is not visible!

Bidou
  • 7,378
  • 9
  • 47
  • 70

2 Answers2

13

You need to set the 'Category' property of the .vstemplate file in the Visual Studio Solution Explorer.

enter image description here

David Gardiner
  • 16,892
  • 20
  • 80
  • 117
  • Wouah, I searched a long time without finding anything! I didn't think it was so simple... Thanks a lot. – Bidou Jun 23 '13 at 17:24
  • Ok, but how can you do that manually in the .vstemplate file? – Thanasis Ioannidis Jan 15 '15 at 08:50
  • 2
    @Saysmaster, this property is not stored in the .vstemplate file. It's stored in the project file that contains the .vstemplate file. Look for an `` node. It's also worth noting that if you want a space in the category name, you need to enter `%20` instead of the space. For example, `Foo%20Bar` will show up as "Foo Bar" in Visual Studio. – reduckted Aug 17 '15 at 06:59
  • To clarify, you just need to set `CSharp`, and then the Category in VSTemplate to Web. No need to use the `` tags. – Albert Aug 01 '19 at 22:44
4

If you manually create the project template (creating a *.zip file that includes the project template) and not through an extensibility solution in visual studio, the subcategory depends on where on the file system you place the project template package. (The category still depends on the ProjectType element in .vstemplate).

For instance, if you create a zip file, where the .vstemplate ProjectType's value is "CSharp" and you place the zip file under (for vs 2010):

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

Then the project will appear under Visual C# (due to the ProjectType) and then under "MySubcategory1\MySubcategory2" hierarchy (Due to the placement in the filesystem)

Project Type Subcategories

Mind that the project template would appear in the same hierarchy (Visual C# - MySubcategory1 - MySubcategory2) even if the zip file was not placed under the Visual C# subfolfer in the templates folder, like below:

"%USERPROFILE%\Documents\Visual Studio 2010\Templates\ProjectTemplates\MySubcategory1\MySubcategory2
Thanasis Ioannidis
  • 2,981
  • 1
  • 30
  • 50