Is there a way to make msbuild write error output to stderr?
c#, msbuild, msbuild-4.0
Solution
Take a look at the MSBUILD.EXE command line arguments page. Specifically the `consoleloggerparameters` switch.
You can use `/clp:ErrorsOnly` to display only errors in the console output.
If you need the rest of the output, include an errors only file log with
/fl4 /flp4:errorsOnly;logfile=MSBuild.Errors.log
then monitor the file for new lines.
Problem
It appears msbuild writes all output (including error output) to standard output. Is there some way to have it write error output (what's normally output in red) to standard error instead? I'm writing a .NET application with a WPF and console interface and calling msbuild using System.Diagnostics.Process. I'd like to be able to distinguish error output to the user somehow. Is there a better of separating the output than looking for "error " in each line or using Microsoft.Build directly + a custom logger?