4

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?

Tahir Hassan
  • 5,715
  • 6
  • 45
  • 65

1 Answers1

7

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.

Keith Hill
  • 194,368
  • 42
  • 353
  • 369
  • You are right. Powershell ISE is just an emulator of console mode. http://blogs.msdn.com/b/powershell/archive/2009/04/17/differences-between-the-ise-and-powershell-console.aspx - says there is no color output for console applications. – Tahir Hassan Feb 06 '14 at 12:09