Share via


How to: Create Item Templates for Specific Project Types

The development environment enables you to make project items available from the Add Item dialog box for certain projects. Use this procedure to make custom items available for Windows, Web, Office, Smart Device, or database projects.

To display item templates for specific project types

  1. Locate the ProjectType element in the .vstemplate file for the item template.

  2. Add a ProjectSubType element immediately after the ProjectType element.

  3. Set the text value of the element to one of the following values:

    • Windows

    • Office

    • Database

    • Smart Devices

    • Web

    For example:

    <ProjectSubType>Database</ProjectSubType>
    

Example

The following example shows an item template available for Office projects.

<VSTemplate Version="2.0.0" Type="Item" Version="2.0.0">
    <TemplateData>
        <Name>Class</Name>
        <Description>An empty class file</Description>
        <Icon>Class.ico</Icon>
        <ProjectType>CSharp</ProjectType>
        <ProjectSubType>Office</ProjectSubType>
        <DefaultName>Class.cs</DefaultName>
    </TemplateData>
    <TemplateContent>
        <ProjectItem>Class1.cs</ProjectItem>
    </TemplateContent>
</VSTemplate>

See Also

Tasks

How to: Create Item Templates

Reference

ProjectType Element (Visual Studio Templates)

ProjectSubType Element (Visual Studio Templates)

Visual Studio Template Schema Reference

Other Resources

Visual Studio Templates