How do u use the Exec task's Output parameter?

The Exec task has an

Output parameter that receives an ITaskItem, but I'm unclear on how to

use it. For example, if I wanted to pass BuildNumber and TeamProject

out from an exec'd msbuild, how would I do that?

THX

Curt

[292 byte] By [CurtZarger] at [2007-12-31]
# 1

By looking at the documentation, it looks like you input items into the Outputs parameter, and you get the exact same items back after.

If you're looking for gathering text output from a tool or command, the Exec task can't do that.

I'm not sure what you mean when you say "if I wanted to pass BuildNumber and TeamProject out from an exec'd msbuild". Are you trying to run msbuild inside a msbuild script by using the Exec task instead of the MSBuild task? Where do the BuildNumber and TeamProject come from?

RaphaelEnns at 2007-9-6 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 2
Raphael,

What I've got is an msbuild project executed via an <exec> task. The <exec> task is part of a wrapper msbuild project. The inside project does mostly TFSBuild stuff, the wrapper project does pre- and post- processing stuff. The problem is that I need to get some information (eg BuildNumber, TeamProject, ...) from the inner project to the outer project. The <exec> task says it supports that, but when you define parameters with the <output> element, an error results saying that the parameters are not defined to the <exec> task as "settable". So I'm wondering what parameters are supported by the <exec> task.

Curt

CurtZarger at 2007-9-6 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 3

Where does it say that the Exec task supports getting values from an inner project to an outer project? From my reading, the Exec task calls cmd.exe and I don't see how it is possible to get any information back from that.

How are you using the Outputs parameter? From my understanding, it should be used like:

<ItemGroup>
<Test Include="C:\*.*" />
</ItemGroup>
<Target Name="Test">
<Message Text="@(Test)" />
<Exec Command="notepad.exe" Outputs="@(Test)">
<Output TaskParameter="Outputs" ItemName="Test2" />
</Exec>
<Message Text="@(Test2)" />
</Target>

Basically you pass values in, and then you get the same values out, but you can put them in another item group. I honestly don't see the value in this at all, and I may be missing something, but that is what the docs seem to say.

From the MSDN documentation:

"The Exec task does not set these itself. Instead, you can provide them as if it did set them, so that they can be used later in the project."

Since the MSBuild task only seems to output the assemblies that were created (using the TargetOutputs task), there doesn't seem to be a simple way to pass outputs from one project to the calling project.

The only way I can think of is to store the values somewhere (eg. in a file) and retrieve it later. Not really a pretty way. Maybe someone else has some ideas. Perhaps you will need to redesign your projects if there is no better solution.

RaphaelEnns at 2007-9-6 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 4
I agree with your read of the the output parameters description. I didn't see the value in this feature either, and was hoping that I read it wrong, or there was some more capability there. Wishful thing I guess. I am already storing values in a separate file. It's not pretty, you're right.
CurtZarger at 2007-9-6 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...

Visual Studio

Site Classified