How to display msbuild errors on the overview page from TeamCity
Asked Answered
B

1

8

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
} }
Bishop answered 10/5, 2013 at 8:32 Comment(3)
Do you have access to the build log file?Flub
Msbuild build log - yesSwitchman
Here is quite good solution: linkSwitchman
S
3

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

Suh answered 25/1, 2014 at 16:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.