Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display msbuild errors on the overview page from TeamCity

I want to use PowerShell with Psake and TeamCity to configure my CI. I used to standard Msbuild runner but now I wrote my own script for building solution but I have problem when msbuild failed.

When I was using Msbuild runner and build failed then on Overview page new section “Build errors” appears and I have there detail from msbuild. But when I wrote my custom scripts I got only error “Process exited with code 1” and I don’t know how to “create” this build errors section. Do you know how to do this? I know that I can use service messages but I can't handle failed log from msbuild.

task compile {
try {
   exec { msbuild $code_dir\SampleSolution.sln /t:Build /p:Configuration=Release }
} catch {
   Write-Host $_ #only information that error occured, but without any msbui details
} }
like image 832
Adam Łepkowski Avatar asked May 10 '13 08:05

Adam Łepkowski


1 Answers

You can specify log for MSBuild

Parse error from log or attach whole log as build artifact.

##teamcity[publishArtifacts '.\msbuild.log']

To fail build you can use the following message

Write-Output "##teamcity[message text='MS Build failed' status='ERROR']"

You can get all messages that can be used here

like image 71
Eduard Kibort Avatar answered Oct 13 '22 21:10

Eduard Kibort