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
} }
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With