nicolas
nicolas

Reputation: 7668

Visual Studio Project template in the Web Category

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!

Upvotes: 8

Views: 1550

Answers (2)

Thanasis Ioannidis
Thanasis Ioannidis

Reputation: 3231

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

Upvotes: 4

David Gardiner
David Gardiner

Reputation: 17166

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

enter image description here

Upvotes: 13

Related Questions