How to: Locate and Organize Project and Item Templates
Template files must be placed in a location that Visual Studio recognizes so that the templates will appear in the New Project and Add New Item dialog boxes. You can create custom subcategories for templates so that the subcategories will also appear in the user interface.
Locating Templates
By default, Visual Studio searches two locations for project and item templates. If a compressed file that includes a .vstemplate file exists in these locations, a template will appear in the New Project or Add New Item dialog boxes.
Installed Templates
By default, templates installed together with the product are located in:
\VisualStudioInstallationDirectory\Common7\IDE\ItemTemplates\Language\Locale\
\VisualStudioInstallationDirectory\Common7\IDE\ProjectTemplates\Language\Locale\
For example, the following directory contains the Visual Studio project templates for English:
C:\VisualStudioInstallationDirectory\Common7\IDE\ItemTemplates\VisualBasic\1033\
Custom Templates
By default, custom templates are located in:
\My Documents\Visual Studio Version\Templates\ProjectTemplates\Language\
\My Documents\Visual Studio Version\Templates\ItemTemplates\Language\
For example, the following directory contains custom Visual C# project templates:
C:\Documents and Settings\UserName\My Documents\Visual Studio 2013\Templates\ProjectTemplates\Visual C#\
Custom templates do not include a subdirectory for localized templates. You can change the default directory for custom templates in the Options dialog box, under Environment\Projects and Solutions.
Organizing Templates
The categories in the New Project and Add New Item dialog boxes reflect the directory structures that exist in the installed and custom template locations. You can modify these directory structures to organize your templates in a way that makes sense to you.
Note
You cannot create a new category at the programming language level. New categories can only be created within each language.
If the directory structures for installed and custom templates for a particular language do not have the same structure (that is, there are directories under one folder that do not exist under the other) the set of categories that appear in the New Project dialog will be the merger of all categories.
Organizing Installed Templates
You can organize installed templates by creating subdirectories in the programming language folder. These subdirectories appear in the New Project and Add New Item dialog boxes as virtual folders within each language.
To create new installed project template categories
Create a folder in the language folder of the installed template directory. For example, to create an Office category for Visual Studio project templates you would create the following directory:
\VisualStudioInstallationDirectory\Common7\IDE\ProjectTemplates\VisualBasic\1033\Office\
Place all the templates for this category in the new folder.
Close all instances of Visual Studio.
On the Start menu, click Run, type cmd, and click OK.
At the command prompt, locate the directory that contains devenv.exe, and type devenv /installvstemplates.
Run Visual Studio.
On the File menu, click New, and then click Project.
Verify that the Office category appears in the New Project dialog box, in the Project types pane, under Visual Basic.
You can also group a subset of the project item templates into a custom folder.
To create new installed item template categories
Create a folder in the language folder of the installed template directory. For example, to create a Web category for Visual C# item templates you would create the following directory:
\VisualStudioInstallationDirectory\Common7\IDE\ItemTemplates\CSharp\1033\Web\
Place all templates for this category in the new folder.
Close all instances of Visual Studio.
On the Start menu, click Run, type cmd, and click OK.
At the command prompt, locate the directory that contains devenv.exe, and type devenv /setup.
Run Visual Studio.
Create a project or open an existing project.
On the Project menu, click Add New Item.
Verify that the Web category appears in the Add New Item dialog box, in the Project types pane.
Organizing Custom Templates
Custom templates can be organized into their own categories by adding new folders in the custom template location. The New Project dialog box reflects any changes you make to your template categories.
To create new custom project template categories
Create a folder in the language folder in the custom project template directory. For example, to create a HelloWorld category for Visual C# templates, you would create the following directory:
\My Documents\Visual Studio 2013\Templates\ProjectTemplates\CSharp\HelloWorld\
Place all the templates for this category in the new folder.
On the File menu, click New, and then click Project.
Verify that the HelloWorld category appears in the New Project dialog box, in the Project types pane, under Visual C#.
You can also group a subset of the custom item templates into a custom folder.
To create new custom item template categories
Create a folder in the language folder in the custom item template directory. For example, to create a HelloWorld category for Visual C# templates you would create the following directory:
\My Documents\Visual Studio 2013\Templates\ItemTemplates\CSharp\HelloWorld\
Place all the templates for this category in the new folder.
Create a project or open an existing project.
On the Project menu, click Add New Item.
Verify that the HelloWorld category appears in the Add New Item dialog box, in the Project types pane.
Displaying Templates in Parent Categories
You can enable templates in subcategories to be displayed in their parent categories by using the NumberOfParentCategoriesToRollUp element in the .vstemplate file. These steps are identical for both project templates and item templates.
To display templates in parent categories
Locate the .zip file that contains the template.
Extract the .zip file.
Open the .vstemplate file in Visual Studio.
In the TemplateData element, add a NumberOfParentCategoriesToRollUp element. For example, the following code makes the template visible in the parent category, but no higher.
<TemplateData> ... <NumberOfParentCategoriesToRollUp> 1 </NumberOfParentCategoriesToRollUp> ... </TemplateData>
Save and close the .vstemplate file.
Select the files in your template, right-click the selection, click Send To, and then click Compressed (zipped) Folder. The files are compressed into a .zip file.
Delete the extracted template files and the old template .zip file.
Put the new .zip file in the directory that had the deleted .zip file.
See Also
Tasks
How to: Create Project Templates
Reference
Visual Studio Template Schema Reference
NumberOfParentCategoriesToRollUp (Visual Studio Templates)