Question

I am using Powershell ISE to run a build script - which in turn uses MSBuild - however - it does not allow the textual colors of MSBuild to shine through. MSBuild outputs color coded messages - yellow, grey, green or red depending on its content.

If I run the script through the normal powershell.exe (which is CMD underneath) I get the color coding.

Within Powershell ISE, I tested it using Write-Host -ForegroundColor Green 'hello' which worked, so is there a reason why the color from MSBuild won't work?

Was it helpful?

Solution

PowerShell.exe is Win32 console-based application and so is MSBUILD.exe which is why it can output using console colors. PowerShell_ISE is not a console-based app. It is a Windows subsystem app - specifically it is a WPF app. What you see with its Command tool window is an emulation of console mode but not a 100% fool proof emulation. If you had access to the old edit.com, it is supposed to work in PowerShell.exe. I'm pretty sure it would not work in the PowerShell_ISE command window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top