Partager via


BuildProjectOnLoad (Visual Studio Templates)

Specifies whether to build the project immediately after it's created.

<VSTemplate>
   <TemplateData>
     <BuildProjectOnLoad>

<BuildProjectOnLoad> true/false </BuildProjectOnLoad>

Attributes and Elements

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

Attributes

None.

Child Elements

None.

Parent Elements

Element

Description

TemplateData

Categorizes the template and defines how it displays in either the New Project or the Add New Item dialog box.

Text Value

A text value is required.

The text must be either true or false, indicating whether to build the project immediately after it's created.

Remarks

BuildProjectOnLoad is an optional attribute. The default value is false.

Example

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

<VSTemplate Type="Project" Version="3.0.0"
    xmlns="https://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateData>
        <Name>My template</Name>
        <Description>A basic template</Description>
        <Icon>TemplateIcon.ico</Icon>
        <ProjectType>CSharp</ProjectType>
        <BuildProjectOnload>true</BuildProjectOnLoad>
    </TemplateData>
    <TemplateContent>
        <Project File="MyTemplate.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>

See Also

Reference

TemplateContent Element (Visual Studio Templates)

Visual Studio Template Schema Reference

Concepts

Creating Templates for Projects and Items in Visual Studio