Export (0) Print
Expand All

Visual Studio Template Metadata Files 

Each template includes a .vstemplate file with the metadata that provides Visual Studio with the information required to display the template in the New Project and Add New Item dialog boxes and create a project or item from the template.

Structure of a .vstemplate File

The .vstemplate file for project templates consists of three fundamental elements:

  • VSTemplate   Identifies the template as a project or item template and provides the template version number.

  • TemplateData   Categorizes the project template and defines display characteristics for the New Project or Add New Item dialog box.

  • TemplateContent   Specifies the files included in the template.

For example, the following code represents a skeleton .vstemplate file for a project template.

<VSTemplate Type=”Project” Version="2.0.0"

Template metadata files are validated by an XML schema that is included with Visual Studio. For more information on the template XML schema, see Visual Studio Template Schema Reference.

Advanced Elements

In addition to the fundamental template XML elements, you can use the WizardExtension and WizardData elements to add custom functionality to the template wizard that creates a new project or item from the template. This custom functionality is achieved by creating an assembly that implements the IWizard interface, and registering that assembly in the .vstemplate file. For more information, see How to: Use Wizards with Project Templates.

Basic Project Template .vstemplate file

The following example shows a custom template for a Visual C# project.

<VSTemplate Type="Project" Version="2.0.0"
        <Name>My template</Name>
        <Description>A basic template.</Description>
        <Project File="MyTemplate.csproj">

See Also

Community Additions

© 2015 Microsoft