Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

teamcity NUnitLauncher .net 4

Using TeamCity 6.5.1
NUnit version 2.5.10
Win2008 x64

Project is using .NET 4.0

Trying to execute the built-in TeamCity NUnit test runner, I receive the following error:

NUnit error running tests in 'E:\TeamCity\LocalBuildAgent\BuildAgent\work\698a8f459eac8cd9\MyProject\bin\Release\MyProject.Tests.dll' assebmly
System.BadImageFormatException: Could not load file or assembly 'E:\TeamCity\LocalBuildAgent\BuildAgent\work\698a8f459eac8cd9\MyProject\MyProject.Tests\bin\Release\MyProject.Tests.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

like image 273
goofballLogic Avatar asked Jun 27 '11 18:06

goofballLogic


1 Answers

My stack is pretty much identical to yours...so, I am going to take a shot in the dark here.

If you go into the Build Step you designated in Team City for running NUnit and find the .NET Runtime section and make sure Platform is set to "auto(MSIL)" and most importantly check to make sure version is set to v4.0.

I have seen your exact error when attempting to run unit tests for a 4.0 project against the 2.0 framework setting.

If it isn't that, I would suggest checking directory permissions and that the System or Network Service accounts which I think team city runs on (unless specified otherwise) can access the directory that your tests.dll resides in.

like image 178
Ian Patrick Hughes Avatar answered Oct 23 '22 19:10

Ian Patrick Hughes