nunit2 Nant task always returns exit code 0 (TeamCity 5.0)

I just cannot for the life of me get my nant build file to terminate upon a test failure and return (thus preventing the packaging and artifact step from running)

This is the unit part of the nant file:

<target name="unittest" depends="build">
  <nunit2 verbose="true" haltonfailure="false" failonerror="true" failonfailureatend="true">
   <formatter type="Xml" />
   <test assemblyname="Code\AppMonApiTests\bin\Release\AppMonApiTests.dll" />

And regardless what combination of true/false i set the haltonfailure, failonerror, failonfailureatend properties to, the result is always this:

[11:15:09]: Some tests has failed in C:\Build\TeamCity\buildAgent\work\ba5b94566a814a34\Code\AppMonApiTests\bin\Release\AppMonApiTests.dll, tests run terminated. 
[11:15:09]: NUnit Launcher exited with code: 1
[11:15:09]: Exit code 0 will be returned.1

Please help as i don't want to be publishing binarys where the unit tests have failed!!!

TeamCity 5.0 build 10669
AppMonApiTests.dll references
nunit.framework.dll v2.5.3.9345
unit isn't installed on the build server or GAC'd
Using Nant-0.85 and Nantcontrib-0.85


Comment actions Permalink


I cannot reproduce the problem.
I'd really appreciate if you create a sample project with single test to illustrate the problem.

Comment actions Permalink


Can you please be explicit with what you need me to do when creating "a sample project". This continues to be a problem (see attachment)

Perhaps you could get one of your programmers to look into the code, since it appears to be a clear problem:

NUnit Launcher exited with code: 1
Exit code 0 will be returned.1

Why is an exit code of 0 ie. success being returned, instead of the actual exit code returned by the NUnit Launcher? (which is instantiated from the use of the nant nunit2 task)


Comment actions Permalink

I have created an issue in our tracker at

Could you please take a look on the issue and watch/vote for it.

You may use 'Fail build if:' section of the first tab of build configuration page to make a build failed if there was at leat one test failed.
Another workaroud could by to start either NUnit-console.exe with TeamCity addin for NUnit or TeamCity NUnit launcher.
Please take a look to the documentation page on that at


Comment actions Permalink

Could you please have a look to the comment I left for the issue at:


Please sign in to leave a comment.