WizardData 元素(Visual Studio 模板)

Specifies custom XML

<VSTemplate>
   <WizardData>

<WizardData>
    <!-- XML to pass to the custom wizard extension -->
    ...
</WizardData>

特性和元素

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

特性

None.

子元素

None.

父元素

Element

Description

VSTemplate

Required element.

Contains all the metadata for the project template, item template, or starter kit.

文本值

A text value is optional.

This text specifies the custom XML to pass to the custom wizard extension specified in the WizardExtension element.

备注

Any XML can be specified in this element. The XML will be passed as a parameter to the custom wizard extension, allowing the extension to use the contents of this element. No validation is done on this data.

The contents of the WizardData element are passed, unchanged, as a parameter inside the string dictionary of parameters in the IWizard.RunStarted method. The parameter is named $WizardData$.

示例

The following example illustrates the metadata for the standard project template for a Visual C# Windows application.

<VSTemplate Version="3.0.0" Type="Item"
    xmlns="https://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateData>
        <Name>MyTemplate</Name>
        <Description>Template using IWizard extension</Description>
        <Icon>TemplateIcon.ico</Icon>
        <ProjectType>CSharp</ProjectType>
    </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>
    <WizardExtension>
        <Assembly>MyWizard, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null</Assembly>
        <FullClassName>MyWizard.CustomWizard</FullClassName>
    </WizardExtension>
    <WizardData>
        <!-- XML to pass to the custom wizard extension -->
    </WizardData>
</VSTemplate>

请参见

任务

如何:使用向导来处理项目模板

参考

Visual Studio 模板架构参考

WizardExtension 元素(Visual Studio 模板)

概念

在 Visual Studio 中创建项目和项的模板