TeamCity ambiguous build failure
Asked Answered
V

1

6

I am having trouble with my build for TeamCity. When I build the project locally, it compiles correctly, however, when TeamCity runs, the build fails with error Build failure condition: Process exited with code 1.

I have two separate projects with this same failure condition and I have no idea even how to begin diagnosing the problem. One project is a C# library created via Visual Studio 2010 (and I use the VS Solution to compile that project) and the other is done using Xamarin Studio.

The Xamarin Studio build step which is to compile the code uses the line (ignore the line breaks):

"C:\Program Files (x86)\Xamarin Studio\bin\mdtool.exe" build
"--project:MyProject" 
"%teamcity.build.checkoutDir/MySolution.sln"

Both projects compile on the build agent (when compiled locally through either Visual Studio or the command line command). Is there a way for me to have the build agent (i.e. the service running) to run the build config locally and test from there or what?

Vowelize answered 6/6, 2013 at 16:13 Comment(0)
E
5

The error you're getting is only the return value from the MSBuild process. In order to debug the build process you need to run it for real - meaning in the same fashion as the build runner will, not doing a local debug build in your dev environment. Follow the steps here to increase the MSBuild logging to verbose and save it to a location where you can inspect it later.

If your application is reasonably complex or has lots of dependencies you'll probably have to spend a few hours writing a build script or editing the project files. If you write build script just change the build task in TC to execute the build script. That's generally the approach I've used with TC since editing the project files will affect your local debug builds.

Eta answered 6/6, 2013 at 16:22 Comment(8)
For the Visual Studio Project, the error is that NUnit does not run correctly:Vowelize
NOTE: This was to be the original note. I was missing a file for the Xamarin Project... I feel dumb for that one. For the Visual Studio Project, the error is that NUnit does not run correctly: The error which I am getting is that No assemblies were found. I currently have a build step for running NUnit test; pointing to %teamcity.build.checkoutDir%***.dll. Without this step, everything works.Vowelize
@BlazePhoenix ok so that shouldn't be too bad to fix. It's one of a few closely related problems either; 1) the NUnit test runner is not being invoked correctly (ie with the correct path to the dlls containing test fixtures/cases), 2) the test runner isn't on the build system/drop location at all or 3) some combination of the previous two like the path to the NUnit Test runner is wrong in the TC build steps or on your local system it's part of your ENV Vars and it's not on the build system so it can't find it.Eta
Okay, I understand what you meant by answer 1. For answer 2, are you stating that I must include the NUnit component to run the tests or the library which houses the tests? (I figured that library would be built with the others as it is part of the build process). As for answer 3, I found that people had searched for setting an environment variable for NUnit, but I am now unsure as to what exactly I am setting to that variable.Vowelize
@BlazePhoenix In order to successfully run NUnit tests as part of your build the NUnit test runner must be on the server where the binaries are dropped. You can set a variable in TC with the path to the DLL or you can append it to the PATH variable on the server. To ensure this is working correctly I would try to manually kick off NUnit on the command line on the build server. If you can do it manually then adding a build step to do it will not be difficult.Eta
So, just to be clear with what you are saying, I need to have something to run the unit test on the server, not the build agent, to get TeamCity to be able to run tests. I will have to set an environment variable on the server machine to point to the test runner.Vowelize
@BlazePhoenix it depends where the files are dropped, but yes, more or less. If your drop folder is on the build agent (I think it normally is) then you need to run the step on the build agent. I think there are some build tasks specifically for executing tests, if not you can just use the command line build task. Add it as a step after the build, the task would just be nothing more than what you enter on the command line to kick of a test run with NUnit.Eta
Okay, well thanks for all of your help! You have been nothing but a blessing for me.Vowelize

© 2022 - 2024 — McMap. All rights reserved.