How get exec task output with msbuild
Good news everyone! You can now capture output from <Exec>
as of .NET 4.5.
Like this:
<Exec ... ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
</Exec>
Simply:
- Add
ConsoleToMsBuild="true"
to your<Exec>
tag - Capture the output using the
ConsoleOutput
parameter in an<Output>
tag
Finally!
Documentation here
I've gotten to the point where I'm so frustrated with the limitations of MSBuild, and the stuff that's supposed to work but doesn't (at least not in every context), that pretty much anytime I need to do anything with MSBuild, I create a custom build task in C#.
If none of the other suggestions are working, then you could certainly do it that way.