Export (0) Print
Expand All
Expand Minimize

Folder Element (Visual Studio Project Templates) 

Specifies a folder that will be added to the project.

<Folder Name="Project Folder">
    <Folder> ... </Folder>
    <ProjectItem> ... </ProjectItem>

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


Attribute Description


Required attribute.

The name of the project folder.


Optional attribute.

Specifies the name to give the folder when a project is created from the template. This attribute is useful for using parameter replacement to create a folder name or naming a folder with an international string that cannot be used directly in the .zip file.

Child Elements

Element Description


Specifies a folder to add to the project. Folder elements can contain child Folder elements.


Specifies a file to add to the project.

Parent Elements

Element Description


Optional child element of TemplateContent.

Folder is an optional child of Project.

You can use any of the following methods to to organize project items into folders in a template:

  • Include the folders in the template .zip file, and add them to the project in the .vstemplate file by specifying the path to the file in the ProjectItem elements, with no Folder elements. This is the recommended method. For example:





  • Include the folders in the template .zip file, and add them to the project in the .vstemplate file with Folder elements. For example:


    <Folder name="Folder">





  • Do not include folders in the template .zip file, but add folders using the TargetFileName attribute of the ProjectItem element. For example:


    <ProjectItem TargetFileName="\Folder\item.cs">item.cs</ProjectItem>



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

<VSTemplate Type="Project" Version="2.0.0"
        <Name>My template</Name>
        <Description>A basic template</Description>
        <Project File="MyTemplate.csproj">
            <Folder Name="Properties">

Community Additions

© 2014 Microsoft