Sathed
Sathed

Reputation: 846

Cannot get my NUnit tests to run because of error

I'm trying to run an NUnit case. When I load the library, I get the following message

System.BadImageFormatException : Could not load file or assembly ... or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

You may be attempting to load an assembly built with a later version of the CLR than the version under which NUnit is currently running, 2.5.5.0727.

I've searched everywhere to find out what is causing this problem. I found another post that mentioned changing in the config file to the current .NET version that is installed. I did that and I am still getting the same error.

I'm currently using NUnit 2.4.8 and the latest version of Selenium 2.0. Any thoughts on this?

EDIT - I've noticed a lot of people are running in to this issue when using the x64 exe when they should be using x86. My library was compiled with an x86 install of Visual C# Express and I'm using the x86 NUnit executable.

Upvotes: 0

Views: 2278

Answers (1)

Johannes Kommer
Johannes Kommer

Reputation: 6451

Which version of the framework have the unit tests been build against? Old version of NUnit (< 2.5.6) have issues with unit tests build against the .NET 4 framework. If you building against the .NET 4 framework then I would highly suggest upgrading to the latest NUnit both to run your tests, and build against.

Upvotes: 2

Related Questions