Folder element (Visual Studio project templates)

Specifies a folder that will be added to the project.

<VSTemplate> <TemplateContent> <Project> <Folder>


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

Attributes and elements

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


Attribute Description
Name Required attribute.

The name of the project folder.
TargetFolderName 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
Folder Specifies a folder to add to the project. Folder elements can contain child Folder elements.
ProjectItem Specifies a file to add to the project.

Parent elements

Element Description
Project Optional child element of TemplateContent.


Folder is an optional child of Project.

You can use any of the following methods 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="3.0.0"
        <Name>My template</Name>
        <Description>A basic template</Description>
        <Project File="MyTemplate.csproj">
            <Folder Name="Properties">

See also