4
votes

TeamCity is set up to build a Visual Studio solution, which can be build locally by a number of developers. However, when TeamCity runs the build, it will always fail the build, even though MSBuild outputs no errors:

[08:49:02][Step 1/1] Process exited with code 1
[08:49:02][Step 1/1] MSBuild output
    [08:49:02][MSBuild output]
    [08:49:02][MSBuild output] 183 Warning(s)
    [08:49:02][MSBuild output] 0 Error(s)
    [08:49:02][MSBuild output]
    [08:49:02][MSBuild output] Time Elapsed 00:01:10.65
[08:49:03][Step 1/1] Step Build solution (Visual Studio (sln)) failed

For comparison, these are the last lines of build output in a local Visual Studio:

54>
54>Build succeeded.
54>
54>Time Elapsed 00:00:11.37
========== Rebuild All: 46 succeeded, 0 failed, 18 skipped ==========

The curious thing is, I cannot find a line which says "Process exited with code 1" locally. I have turned of all pre/post build events for each project. I've looked for possible culprits throughout the build log from TeamCity, but I cannot find any clue related to why it exits with code 1.
Interestingly, the build does produce the necessary artifacts, which are valid!

Why is my build exiting with code 1?

EDIT in response to comments:

  • Same version of msbuild
  • running msbuild on the server in command line, generate a build.log file with the same results "x warnings, 0 errors". echo %errorlevel% returns 0.
  • there is no settings to "Treat warnings as errors"
  • I'll try to post to complete output, but i need to anonymize it first.
1
Have you tried building your project manually on Teamcity's Agent host?. Also, would be good if you can post the complete output from TC console.Arpit
Try using msbuild from the command line locally, it may give different results to running it through Visual Studio. Also, are you sure it's the same version of msbuild running locally and on TeamCity?Nanhydrin
see edit for answersRoelF

1 Answers

0
votes

I can think of 3 issues:

  1. It looks like TeamCity fails the build step if warnings are encountered - can you check that is not the case?

  2. As others have commented, please try to do an ms build from the command line. Have a look at the exact command line argumes Team city is invoking msbuild with.

  3. There are settings in the projects themselves to "treat warning as errors" but then msbuild would obey those rules. Did you customize your build ? For more info see this.