Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Project Element (Visual Studio Templates)
Collapse the table of content
Expand the table of content

Project Element (Visual Studio Templates) 

Specifies the files or directories to add to the project.


<Project
    File="MyProject.proj"
    TargetFileName="MyTargetProject.proj"
    ReplaceParameters="true/false">
        ...
</Project>

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

Attributes

Attribute Description

File

Required attribute.

Specifies the name of the project file in the template .zip file.

ReplaceParameters

Optional attribute.

A Boolean value that specifies whether the project file has parameter values that must be replaced when a project is created from the template. Default value is false.

TargetFileName

Optional attribute.

Specifies the name of the project file when a project is created from the template.

Child Elements

Element Description

Folder

Optional element.

Specifies a folder to add to the project.

ProjectItem

Optional element.

Specifies a file to add to a project.

Parent Elements

Element Description

TemplateContent

Required element.

Project is an optional child element of TemplateContent.

The Project element is used to specifiy a project, and therefore, is only valid in project templates.

Project elements can have Folder children elements or ProjectItem children elements, but not a mixture of both Folder and ProjectItem children elements.

Visual Studio automatically renames the project file name based on the name entered by the user in the New Project dialog box. Use the TargetFileName attribute if you want to provide an alternate file name for project files created with the template.

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

<VSTemplate Type="Project" Version="2.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>

Community Additions

ADD
Show:
© 2015 Microsoft