Export (0) Print
Expand All

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, 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

    • Web

    For example:

    <ProjectSubType>Database</ProjectSubType>
    

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>

Community Additions

ADD
Show:
© 2014 Microsoft