I am running a build, and I would like to be able to view the progress as it happens. But I would also like to save the output if the build has an error.
I know I can use Process.UseShellExecute = false, and RedirectStandardOutput, but that’s only part of the story.
How can I do this?
Update
As Greg mentions in the comments below, MSBuild can write out to a log file while also outputting to console out of the box.
Try the following simple C# program. It will take the redirected STDIN (
Console.In) and write it to one or more files and STDOUT (Console.Out).I use it to redirect the output from an MSBuild batch file to disk whilst still outputting to the console window.