共用方式為


TemplateContent 項目 (Visual Studio 範本)

指定範本的內容。

<TemplateContent>
    ...
</TemplateContent>

屬性和項目

下列章節會說明屬性、子項目和父項目。

屬性

屬性

描述

BuildOnLoad

指定當您從範本建立專案時,是否要建置方案。

子項目

元素

描述

ProjectCollection

選擇性項目。

指定多個專案範本的組織和內容。

專案

選擇性項目。

指定要加入至專案的檔案或目錄。

參考

選擇性項目。

指定項目範本所需的組件參考。

ProjectItem

選擇性項目。

指定範本中所包含的檔案。

CustomParameters

選擇性項目。

指定要使用的任何自訂參數,當專案或項目從範本建立。

父項目

元素

描述

VSTemplate

必要項目。

包含專案範本、項目範本或入門套件的所有中繼資料。

備註

TemplateContent 是必要項目。

範例

下列程式碼範例會示範 Visual C# 應用程式專案範本的中繼資料。

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

請參閱

參考

Visual Studio 範本結構描述參考

概念

在 Visual Studio 中建立專案和項目的範本