次の方法で共有


SupportsMasterPage Element (Visual Studio Templates)

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Specifies whether the or not the Select Master Page checkbox is enabled on the Add New Item dialog box.

<VSTemplate> <TemplateData> <SupportsMasterPage>

Syntax

<SupportsMasterPage> true/false </SupportsMasterPage>

Attributes and Elements

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

Attributes

None.

Child Elements

None.

Parent Elements

Element Description
TemplateData Specifies data that categorizes the template, and defines how it displays in the New Project or New Item dialog box.

Text Value

A text value is required.

The text must be either true or false, indicating whether or not the Select Master Page checkbox is enabled on the Add New Item dialog box.

Remarks

SupportsMasterPage is an optional element. The default value is false.

The SupportsMasterPage element is only available for Web item templates.

Example

The following example illustrates the metadata for a Web project that includes support for a master page.

<VSTemplate Version="3.0.0" Type="Project"
    xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">>
    <TemplateData>
        <Name>MyWebProjecStarterKit</Name>
        <Description>A simple Web template</Description>
        <Icon>icon.ico</Icon>
        <ProjectType>Web</ProjectType>
        <ProjectSubType>CSharp</ProjectSubType>
        <DefaultName>WebSite</DefaultName>
        <SupportsMasterPage>true</SupportsMasterPage>
    </TemplateData>
    <TemplateContent>
        <Project File="WebApplication.webproj">
            <ProjectItem>icon.ico</ProjectItem>
            <ProjectItem OpenInEditor="true">Default.aspx</ProjectItem>
            <ProjectItem>Default.aspx.cs</ProjectItem>
        </Project>
    </TemplateContent>
</VSTemplate>

See also