I've got my windows shell configured as displaying black text on a white background. This makes it almost impossible to read the default msbuild output due to the very pale colours (especially the yellow warnings).
Therefore I'd like to try one of the following, but I can't work out if it is possible.
- I'd like to set a global setting to permanently turn off colourized output in msbuild; or
- If (1) isn't possible is it possible to turn this output per-invocation (e.g. with command line arguments).
Does anyone know how to do one of the above?
To completely disable colors use the
/clp:disableconsolecolor
option when invokingMSBuild.exe
(for more information on the/clp
option runMSBuild.exe /?
).Update as @KMoraz has commented, and updated his answer to, this only works with MSBuild 4.0 onwards.
If you want to disable color output you can also use the following (which will not work with MSBuild 4.0):
This got me curious ;-) so here is one more option that should work with all versions of MSBuild.exe and doesn't rely on
CON
redirection:Basically, what happens is that all lines of output are piped through
findstr.exe
since that uses a pattern to match "everything", all lines are simply output again, but loosing their attributes (color) information. In my tests the2>&1
(redirect stderr to stdout) was not really necessary, as it looks MSBuild doesn't output any (colored) messages to stderr, but I added it for good measure.In MSBuild 4.0 this is possible using the
/consoleloggerparameters
or/clp
switch:Alternatively, for previous MSBuild engines, this is possible using PowerShell:
Out-Host
will display the default color:Write-Host
will let you customize the colors: