CreateInPlace 元素 (Visual Studio 範本)

指定是否要在指定的位置建立專案並執行參數取代,或在暫存位置執行參數取代,然後將專案儲存至指定的位置。

<VSTemplate><TemplateData><CreateInPlace>

語法

<CreateInPlace> true/false </CreateInPlace>

屬性和元素

下列章節說明屬性、子元素和父元素。

屬性

無。

子元素

無。

父元素

元素 描述
TemplateData 將範本分類,並定義該範本在 [新增專案] 或 [加入新項目] 對話方塊中顯示的方式。

文字值

需要文字值。

此文字必須是 truefalse。 如果true為 ,則會建立專案,並在 [新增專案] 對話框中所指定的位置執行參數取代。 如果 false為 ,則會在暫存位置執行參數取代,然後將專案複製到指定的位置。

備註

CreateInPlace 是選擇性項目。 預設值是 true

範例

下列範例說明 Visual C# 範本的元數據。

<VSTemplate Type="Project" Version="3.0.0"
    xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateData>
        <Name>My template</Name>
        <Description>A basic template</Description>
        <Icon>TemplateIcon.ico</Icon>
        <ProjectType>CSharp</ProjectType>
        <CreateInPlace>false</CreateInPlace>
    </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>

另請參閱