Visual Studio Online - output colouring by tag

Tags: Azure, CI, Powershell, TFS, VSO

I started being more involved in continuous integration and deployment using Visual Studio Online which is ‘the new‘ TFS hosted in Azure.

I've discovered an interesting and useful feature when using it PowerShell. When you use Write-Host if you add [Debug], [Warning] and [Error] in your output string then you get a nice colour in the Console and Logs pages of the build result.

Have a look at the below images.

vso build 1

vso build 2

In this example the following output was used:

Write-Host "[Debug] Debug value"
Write-Host "[Warning] Warning value"
Write-Host "[Error] Error value"

As you can see the Console doesn't shows the value in square brackets.


This worked for me in both Azure hosted and local hosted agent. I guess it should be the same on the TFS hosted on premises.

Comments

comments powered by Disqus