Powershell "Build Overview", "Build Log" and "Build errors"


I am running a build configuration with ant and one with powershell. If a build fails with the ant configuration a small build log is presented in the "Build Overview" Tab, but none for the powershell configuration.
How can i generally manipulate what is shown at the "Build Overview" Tab?
I am working with Write-Warning and Write-Error and setting the LastExitCode in my powershell script.

The second problem I have is how I can format or colorize the messages in the "Build Log"-Tab for the powershell scripts?
This is probably a powershell issue, but how does TC capture the messages or determines which are error-messages and which are not?

The output of the scripts (linebreakage) looks different if the scripts are run by TeamCity instead of powershell ise.
In order to make it look similar I manipulated the buffer size with: [$host.UI.RawUI.BufferSize.Width = 512] and now the Write-Host messages don't have line breaks, but the Write-Warning messages still have line breaks.
How can I change that, so the messages look more pretty, and how can i make the warning messages orange or red?

It looks for example like this (the first line doesn't have linebreaks, the following which are written with write-warning have)

[12:04:23]: Compilation check for: StdAfx.cpp bbbbbbbbbbbbbbbbbbbbbbbbb.cpp (C:\BuildAgent\work\d460e9346a03bcee\Sources\XXXX\Yyyyyyyyyyy\zzzzzzzz\zzzzzzzz.vcxproj)...

[12:06:10]: WARNUNG: Error compiling

[12:06:10]: C:\BuildAgent\work\d460e9346a03bcee\Sources\XXXX\Yyyyyyyyyyy\zzzzzzzz\zzzzzzzz.

[12:06:10]: vcxproj with configuration Debug|x64

[12:06:10]: WARNUNG:

[12:06:10]: "C:\BuildAgent\work\d460e9346a03bcee\Sources\XXXX\Yyyyyyyyyyy\zzzzzzzz\zzzzzzzz

[12:06:10]: .vcxproj" (default target) (1) ->

[12:06:10]: "C:\BuildAgent\work\d460e9346a03bcee\Sources\XXXX\Yyyyyyyyyyy\aaaaaaaaaaaaaaaa

[12:06:10]: aa\aaaaaaaaaaaaaaaaaaa.vcxproj" (default target) (8) ->

[12:06:10]: (PostBuildEvent target) ->

[12:06:10]: C:\Program Files

[12:06:10]: (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error

[12:06:10]: MSB3073: The command "xcopy

Thanks for any help
1 comment
Comment actions Permalink

Hi Frank

In build logs we have three types of messages - common (black), warnings (brown), and errors (red).
Powershell and command-line runners read two output streams - stdout is logged as common messages, stderr as warnings.
Build overview page shows errors only, this is why you see nothing there.

Inside the script you can send additional messages to TeamCity and control their types using service messages.

The issue with line breaks is caused by PowerShell interpreter, and not much can be done at TeamCity side. Microsoft Technet forums would be better place to troubleshoot that.



Please sign in to leave a comment.