How to Use NUnit 2.4.5?

I get following exception with TeamCity 3.0

: Project "DACommunity.sln.teamcity.patch.proj"
(Build_TeamCity_generated_7051bbe6981e445a9d3af0d5d7188203;NUnit_TeamCity_generated_7051bbe6981e445a9d3af0d5d7188203
target(s)): (21s)
: [Project "DACommunity.sln.teamcity.patch.proj"
(Build_TeamCity_generated_7051bbe6981e445a9d3af0d5d7188203;NUnit_TeamCity_generated_7051bbe6981e445a9d3af0d5d7188203
target(s)):] Target
"NUnit_TeamCity_generated_7051bbe6981e445a9d3af0d5d7188203" in project
"DACommunity.sln.teamcity.patch.proj" (8s)
: [Target
"NUnit_TeamCity_generated_7051bbe6981e445a9d3af0d5d7188203" in project
"DACommunity.sln.teamcity.patch.proj"] Failure executing test(s). If you
assembly is not built using NUnit version 2.2.8.0, then ensure you have
redirected assembly bindings. Consult the documentation of the ]]> task
for more information.
: [Target
"NUnit_TeamCity_generated_7051bbe6981e445a9d3af0d5d7188203" in project
"DACommunity.sln.teamcity.patch.proj"] Die Datei oder Assembly
nunit.framework, Version=2.4.5.0, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77 oder eine Abhängigkeit davon wurde nicht
gefunden. Das System kann die angegebene Datei nicht finden.
StackTrace:

How to fix that?

1 comment

It looks like you're using the NUnit2 task from within and NAnt build script.

If that's the case:

Usage of the NUnit2 task is discouraged (I don't know the exact reasons, but I guess it has to do with the NAnt developers not wanting to bind themselves to a specific version). Instead, nunit-console.exe should be invoked directly. A future version of NAnt will probably fix this by implementing a propert NUnit2 task that does this behind the scenes.

Here's a workaround that still allows you to track the test results in TeamCity:

<!-- If we're being run by TeamCity, use their NUnit launcher -->
<if test="$">
]]>

In other words, check for the 'teamcity.dotnet.nunitlauncher2.0' property and, if it is set, your build is being run by TeamCity and instead of nunit-console.exe, you need to execute whatever executable the property is pointing to.

-Markus-

0

Please sign in to leave a comment.