Templates for Creating Templates
The Visual Studio SDK includes a Project Template template and an Item Template template that you can use for template development. These templates include some common parameter substitutions, and build as compressed files instead of as Dynamic Link Libraries (DLLs) or executables.
The template-creation templates let you include template projects in larger extensions without building the individual templates. This lets you implement version control on the source files and build a group of template projects into one VSIX package.
We recommend that you use the Project Template and Item Template templates for the following scenarios:
Creating extensions that have multiple templates.
Creating extensions that include templates and other components.
Any template creation scenarios in which content-level version control is desirable.
Any scenarios that are not supported by the Export Template wizards.
For basic template creation scenarios, we recommend that you use the Export Template Wizard (which outputs to a compressed file) or the Export Template Wizard extension (which outputs to a .vsix file.) For scenarios that are not supported by the templates or by the wizards, you can create templates manually. For a comparison of the different template-creation strategies, see Creating Project and Item Templates.
Locations for the Project Template and Item Template Templates
The Project Template and Item Template templates are available in two locations in the New Project dialog box:
Under Visual Basic Extensibility. The default language of the project is Visual Basic.
Under C# Extensibility. The default language of the project is C#.
Creating a Project Template
To create a project template
Create a Project Template project.
The template generates an empty class, an icon, a .vstemplate file, an editable project file named ProjectTemplate.vbproj or ProjectTemplate.csproj, and some files that are typically generated by other project types, such a resources.resx file, an AssemblyInfo file, and a .settings file. Each code file contains common parameter substitutions where appropriate.
Add and remove items from the project as required for your project. Do not remove the editable project file, the AssemblyInfo file, or the .vstemplate file.
Update the .vstemplate file to reflect any additions and deletions. The Project element must contain a ProjectItem element for each file to be included in the template.
Modify your code files and other user-facing content, and add appropriate parameter substitutions.
Modify generated content as required.
Build the project.
Visual Studio creates a compressed file that contains your template.
Creating an Item Template
To create an item template
Create an Item Template project.
The template generates an empty class, an icon, a .vstemplate file, and an AssemblyInfo file. The class file contains some common parameter substitutions.
Add and remove items from the project as required for your project.
Update the .vstemplate file to reflect any additions and deletions. The Project element must contain a ProjectItem element for each file to be included in the template.
Modify your code files and other user-facing content, and add appropriate parameter substitutions.
Modify generated content as required.
Build the project.
Visual Studio creates a compressed file that contains your template.
Deployment
To deploy the templates
Create a VSIX project. For more information, see VSIX Project Template.
Open the .vsixmanifest file.
Click Add Content.
For content type, select Project Template or Item Template.
For source, select the Project option, and then select the project that contains your template.
Repeat this step for each template to be added to your deployment package.
Build the VSIX project.
Visual Studio creates a deployable .vsix file in the \bin\debug\ folder of your project. For more information about VSIX deployment, see VSIX Deployment.
See Also
Tasks
How to: Use the Template Wizard Extension