共用方式為


TaskBody Element (MSBuild)

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

Contains the data that is passed to a UsingTask``TaskFactory. For more information, see UsingTask Element (MSBuild).

<Project>
<UsingTask>
<TaskBody>

Syntax

<TaskBody Evaluate="true/false" />  

Attributes and Elements

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

Attributes

Attribute Description
Evaluate Optional Boolean attribute.

If true, MSBuild evaluates any inner elements, and expands items and properties before it passes the information to the TaskFactory when the task is instantiated.

Child Elements

Element Description
Data The text between the TaskBody tags is sent verbatim to the TaskFactory.

Parent Elements

Element Description
UsingTask Provides a way to register tasks in MSBuild. There may be zero or more UsingTask elements in a project.

Example

The following example shows how to use the TaskBody element with an Evaluate attribute.

<UsingTask TaskName="MyTask" AssemblyName="My.Assembly" TaskFactory="MyTaskFactory">  
       <ParameterGroup>  
              <Parameter1 ParameterType="System.String" Required="False" Output="False"/>  
              <Parameter2 ParameterType="System.Int" Required="True" Output="False"/>  
              ...  
</ParameterGroup>  
       <TaskBody Evaluate="true">  
      ... Task factory-specific data ...  
       </TaskBody>  
</UsingTask>  

See Also

Tasks
Task Reference
Project File Schema Reference