Output Element (MSBuild)

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Stores task output values in items and properties.

<Project>
<Target>
<Task>
<Output>

<Output TaskParameter="Parameter"  
    PropertyName="PropertyName"   
    Condition = "'String A' == 'String B'" />  

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

Attributes

AttributeDescription
TaskParameterRequired attribute.

The name of the task's output parameter.
PropertyNameEither the PropertyName or ItemName attribute is required.

The property that receives the task's output parameter value. Your project can then reference the property with the $(PropertyName) syntax. This property name can either be a new property name or a name that is already defined in the project.

This attribute cannot be used if ItemName is also being used.
ItemNameEither the PropertyName or ItemName attribute is required.

The item that receives the task's output parameter value. Your project can then reference the item with the @(ItemName) syntax. The item name can either be a new item name or a name that is already defined in the project.

This attribute cannot be used if PropertyName is also being used.
ConditionOptional attribute.

Condition to be evaluated. For more information, see Conditions.

Child Elements

None.

Parent Elements

ElementDescription
TaskCreates and executes an instance of an MSBuild task.

The following code example shows the Csc task being executed inside of a Target element. The items and properties passed to the task parameters are declared outside of the scope of this example. The value from the output parameter OutputAssembly is stored in the FinalAssemblyName item, and the value from the output parameter BuildSucceeded is stored in the BuildWorked property. For more information, see Tasks.

<Target Name="Compile" DependsOnTargets="Resources">  
    <Csc  Sources="@(CSFile)"  
            TargetType="library"  
            Resources="@(CompiledResources)"  
            EmitDebugInformation="$(includeDebugInformation)"  
            References="@(Reference)"  
            DebugType="$(debuggingType)"  
            OutputAssembly="$(builtdir)\$(MSBuildProjectName).dll" >  
        <Output TaskParameter="OutputAssembly"  
                  ItemName="FinalAssemblyName" />  
        <Output TaskParameter="BuildSucceeded"  
                  PropertyName="BuildWorked" />  
    </Csc>  
</Target>  

Project File Schema Reference
Tasks

Show: