Visual Studio Project template in the Web Category
Asked Answered
H

2

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!

Homerus answered 20/6, 2013 at 12:8 Comment(0)
D
13

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

enter image description here

Deform answered 22/6, 2013 at 22:36 Comment(4)
Wouah, I searched a long time without finding anything! I didn't think it was so simple... Thanks a lot.Homerus
Ok, but how can you do that manually in the .vstemplate file?Blakely
@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 <OutputSubPath> 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.Pinkham
To clarify, you just need to set <ProjectType>CSharp</ProjectType>, and then the Category in VSTemplate to Web. No need to use the <ProjectSubType> tags.Floaty
B
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
Blakely answered 15/1, 2015 at 9:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.