SupportsCodeSeparation Element (Visual Studio Templates)
Applies to: Visual Studio Visual 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 or not the Place code in separate file check box is enabled in the Add New Item dialog box.
<VSTemplate> <TemplateData> <SupportsCodeSeparation>
Syntax
<SupportsCodeSeparation> true/false </SupportsCodeSeparation>
Attributes and Elements
The following sections describe attribute, child elements, and parent elements.
Attributes
None.
Child Elements
None.
Parent Elements
Element | Description |
---|---|
TemplateData | Required element. Categorizes the template and defines how it displays in either the New Project or the New Item dialog box. |
Text Value
A text value is required.
The text must be either true
or false
, indicating whether or not the Place code in separate file check box is enabled in the Add New Item dialog box.
Remarks
SupportsCodeSeparation
is an optional element. The default value is false
.
The SupportsCodeSeparation
element is only available for Web item templates.
Code separation, or the code-behind page model, allows you to keep the markup in one file and the programming code in another file. ASP.NET and other .NET languages use this model.
Example
The following example specifies to display the Place code in separate file option.
<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>
<SupportsCodeSeparation>true</SupportsCodeSeparation>
</TemplateData>
<TemplateContent>
<Project File="WebApplication.webproj">
<ProjectItem>icon.ico</ProjectItem>
<ProjectItem OpenInEditor="true">Default.aspx</ProjectItem>
<ProjectItem>Default.aspx.cs</ProjectItem>
</Project>
</TemplateContent>
</VSTemplate>