Udostępnij za pośrednictwem


ProjectTemplateLink Element (Visual Studio Templates)

Specifies the path to the .vstemplate file of one project in a multi-project template.

<VSTemplate>
  <TemplateContent>
    <ProjectCollection>
      <ProjectTemplateLink>
        -or-
          <VSTemplate>
            <TemplateContent>
              <ProjectCollection>
                <SolutionFolder>
                  <ProjectTemplateLink>

<ProjectTemplateLink ProjectName="Name">
    PathToTemplateFile
</ProjectTemplateLink>

Attributes and Elements

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

Attributes

Attribute

Description

ProjectName

Optional attribute.

Specifies the name for each individual project in a multi-project template. The New Project dialog box cannot assign names to individual projects.

Child Elements

None.

Parent Elements

Element

Description

ProjectCollection

Specifies the organization and contents of multi-project templates.

SolutionFolder

Groups projects in multi-project templates.

Text Value

A text value is required.

This text specifies the path to the .vstemplate file of the template.

Remarks

Multi-project templates act as containers for two or more projects. The ProjectTemplateLink element is used to specify the location of the .vstemplate file for one of the projects in the template. The .vstemplate file of a multi-project template contains one ProjectTemplateLink element for each project in the template. For more information on multi-project templates, see How to: Create Multi-Project Templates.

Example

This example shows a simple multi-project root .vstemplate file. In this example, the template contains two projects, My Windows Application and My Class Library. The ProjectName attribute on the ProjectTemplateLink element sets the name for Visual Studio to assign this project. If the ProjectName attribute does not exist, the name of the .vstemplate file is used as the project name.

<VSTemplate Version="2.0.0" Type="ProjectGroup"
    xmlns="https://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateData>
        <Name>Multi-Project Template Sample</Name>
        <Description>An example of a multi-project template</Description>
        <Icon>Icon.ico</Icon>
        <ProjectType>VisualBasic</ProjectType>
    </TemplateData>
    <TemplateContent>
        <ProjectCollection>
            <ProjectTemplateLink ProjectName="My Windows Application">
                WindowsApp\MyTemplate.vstemplate
            </ProjectTemplateLink>
            <ProjectTemplateLink ProjectName="My Class Library">
                ClassLib\MyTemplate.vstemplate
            </ProjectTemplateLink>
        </ProjectCollection>
    </TemplateContent>
</VSTemplate>

See Also

Tasks

How to: Create Multi-Project Templates

Reference

Visual Studio Template Schema Reference

Other Resources

Visual Studio Templates