Output 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
Stores task output values in items and properties.
<Project>
<Target>
<Task>
<Output>
Syntax
<Output TaskParameter="Parameter"
PropertyName="PropertyName"
Condition = "'String A' == 'String B'" />
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
Attribute | Description |
---|---|
TaskParameter |
Required attribute. The name of the task's output parameter. |
PropertyName |
Either 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. |
ItemName |
Either 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. |
Condition |
Optional attribute. Condition to be evaluated. For more information, see Conditions. |
Child Elements
None.
Parent Elements
Element | Description |
---|---|
Task | Creates and executes an instance of an MSBuild task. |
Example
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>