.NET Framework Bookmark and Share   
 index > MSBuild > How to get the output value of a task inside a target from the caller target
 

How to get the output value of a task inside a target from the caller target


In a Target A, I call another Target B. In B, I have a task which has an output value, how can I get this value from the caller Target A?Thanks.

<Target Name="B">
<Exec Command="some command" >
<Output TaskParameter="ReturnParam" ItemName="Value">
</Exec>

<Message Text = "@(Value)"></Message>
</Target>

<Target Name="A">

<CallTarget Targets="B"/>
<Message Text = "@(Value)"></Message>

</Target>

JXD
  • Marked As Answer byJXD Tuesday, September 01, 2009 4:44 PM
  •  
Sayed Ibrahim Hashimi
Hi,
There is a bug related to omitting properties and items when using the CallTarget task. Instead of using the CallTarget task you can make the target A depend on Target B by using the DependsOnTargets attribute of the Target elements.

Sayed Ibrahim Hashimi
My Book: Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build
My Blog: sedodream.com
Visual C# MVP
Sayed Ibrahim Hashimi
Thanks for reply. Could you give the link to the bug you tried to link to? Apprently the link is broken. Thanks.
JXD
  • Marked As Answer byJXD Tuesday, September 01, 2009 4:44 PM
  •  
Sayed Ibrahim Hashimi

You can use google to search for other answers

Custom Search

More Threads

• #if blocks disable valid code
• Cruise control build output files using MSbuild
• Supported projects
• documentation bug
• Invoking Unit tests as part of build process..
• Relative Path In Build rule
• Getting targets to run more than once
• Is it possible to specify "encoding" for file included in the project to open it with?
• Accessing properties of the current/executing project from task
• Building multiple projects