| title | TemplateContent Element (Visual Studio Templates) | |
|---|---|---|
| description | Learn about the TemplateContent element and how it specifies the contents of the template. | |
| ms.date | 11/04/2016 | |
| ms.subservice | general-ide | |
| ms.topic | reference | |
| f1_keywords | ||
| helpviewer_keywords |
|
|
| author | tinaschrepfer | |
| ms.author | tinali |
Specifies the contents of the template.
Element hierarchy:
<VSTemplate>
<TemplateContent><TemplateContent>
...
</TemplateContent>The following sections describe attributes, child elements, and parent elements.
| Attribute | Description |
|---|---|
| BuildOnLoad | Specifies whether to build the solution when a project is created from the template. |
| Element | Description |
|---|---|
| ProjectCollection | Optional element. Specifies the organization and contents of multi-project templates. |
| Project | Optional element. Specifies files or directories to add to the project. |
| References | Optional element. Specifies the assembly references required for an item template. |
| ProjectItem | Optional element. Specifies a file contained in the template. |
| CustomParameters | Optional element. Specifies any custom parameters that are to be used when a project or item is created from the template. |
| Element | Description |
|---|---|
| VSTemplate | Required element. Contains all the metadata for the project template, item template, or starter kit. |
TemplateContent is a required element.
The following example shows the metadata for a project template for a Visual C# application.
<VSTemplate Type="Project" Version="3.0.0"
xmlns="http://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>