Compartilhar via


TemplateData Element (Visual Studio Templates)

Categorizes the template and defines how it displays in either the New Project or the Add New Item dialog box.

<VSTemplate>
   <TemplateData>

<TemplateData>
    <Name> ... </Name>
    <Description> ... </Description>
    <Icon> ... </Icon>
    <ProjectType> ... </ProjectType>
    ...
</TemplateData>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

Element

Description

Name

Required element.

Specifies the name of the template as it appears in either the New Project or the Add New Item dialog box.

Description

Required element.

Specifies the description of the template as it appears in either the New Project or the Add New Item dialog box.

Icon

Required element.

Specifies the path and the filename of the image file that serves as the icon, which appears in either the New Project or the Add New Item dialog box, for the template.

ProjectType

Required element.

Categorizes the project template so that it appears under the specified group in the New Project dialog box.

ProjectSubType

Optional element.

Classifies the project template so that it appears under the specified subcategory in the New Project dialog box.

TemplateID

Optional element.

Specifies the template ID.

TemplateGroupID

Optional element.

Specifies the template group ID.

SortOrder

Optional element.

Specifies a value that is used to arrange the template, among other templates in the same category, as it appears in either the New Project or Add New Item dialog box.

CreateNewFolder

Optional element.

Specifies whether a containing folder is created on instantiation of the project.

DefaultName

Optional element.

Specifies the name that the Visual Studio project system will generate for the project or item when it is created.

ProvideDefaultName

Optional element.

Specifies whether the Visual Studio project system will generate the default name for a project or item when it is created.

PromptForSaveOnCreation

Optional element.

Specifies whether the project can be created as a temporary project.

EnableLocationBrowseButton

Optional element.

Specifies whether the Browse button is available in the New Project dialog box, so that users can easily modify the default directory where a new project is saved.

Hidden

Optional element.

Specifies whether the template appears in either the New Project or Add New Item dialog box.

NumberOfParentCategoriesToRollUp

Optional element.

Specifies the number of parent categories that will display the template in the New Project dialog box.

LocationFieldMRUPrefix

Optional element.

LocationField

Optional element.

Specifies whether or not the Location text box in the New Project dialog box is either enabled, disabled, or hidden for the project template.

RequiredFrameworkVersion

Optional element.

Use this element if the template only supports a specific minimum version, and later versions if any, of the .NET Framework.

SupportsMasterPage

Optional element.

Specifies whether the template supports a master page for web projects.

SupportsCodeSeparation

Optional element.

Specifies whether the template supports code separation, or the code-behind page model, for web projects.

SupportsLanguageDropDown

Optional element.

Specifies whether the template is identical for multiple languages, and whether the Language option is available from the New Project dialog box.

TargetPlatformName

Optional element.

Specifies the platform that the project template targets. This element specifies that a project template is used to create Windows Store apps.

Parent Elements

Element

Description

VSTemplate

Required element.

Contains all the metadata for the project template, item template, or starter kit.

Remarks

TemplateData is a required element.

If you do not include an optional element, the default value for that element is used.

Example

The following example shows the metadata for a project template for a Visual C# application.

<VSTemplate Type="Project" Version="3.0.0"
    xmlns="https://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateData>
        <Name>My template</Name>
        <Description>A basic starter kit</Description>
        <Icon>TemplateIcon.ico</Icon>
        <ProjectType>CSharp</ProjectType>
    </TemplateData>
    <TemplateContent>
        <Project File="MyStarterKit.csproj">
            <ProjectItem>Form1.cs<ProjectItem>
            <ProjectItem>Form1.Designer.cs</ProjectItem>
            <ProjectItem>Program.cs</ProjectItem>
            <ProjectItem>Properties\AssemblyInfo.cs</ProjectItem>
            <ProjectItem>Properties\Resources.resx</ProjectItem>
            <ProjectItem>Properties\Resources.Designer.cs</ProjectItem>
            <ProjectItem>Properties\Settings.settings</ProjectItem>
            <ProjectItem>Properties\Settings.Designer.cs</ProjectItem>
        </Project>
    </TemplateContent>
</VSTemplate>

See Also

Reference

Visual Studio Template Schema Reference

Concepts

Creating Templates for Projects and Items in Visual Studio