Udostępnij za pośrednictwem


PromptForSaveOnCreation Element (Visual Studio Templates)

Note

This article applies to Visual Studio 2015. 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 user is prompted for a project save location via the New Project dialog box when creating a project. If this element is set to true, then the user is prompted for a save location; if false, then they are not prompted. (That is, a temporary project is created.)

<VSTemplate>
<TemplateData>
<PromptForSaveOnCreation>

Syntax

<PromptForSaveOnCreation> true/false </PromptForSaveOnCreation>  

Attributes and Elements

The following sections describe attributes, 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 Add New Item dialog box.

Text Value

A text value is required.

The text must be either true or false, true indicating that the user will be prompted for a save location when creating a new project.

Remarks

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

Temporary projects are projects that you can create and modify without saving the contents of that project on disk. For more information, see NIB Temporary Projects.

Example

The following example sets the value of PromptForSaveOnCreation equal to false, which specifies to allow the project to be created as a temporary project.

<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>  
        <PromptForSaveOnCreation>false</PromptForSaveOnCreation>  
    </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

Visual Studio Template Schema Reference
Creating Project and Item Templates