0
votes

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.

1
Have you verified the assembly (dll) didn't actually come from a later version?m.edmondson
Which dll are you referring to?Sathed
Version 2.5.5.0727 isn't a framework version number, it's an NUnit version number - looks like you have a mix of assemblies between NUnit 2.4.8 and 2.5.5. Also, it doesn't matter that your Visual Studio installation is x86 - what matters is the output type configured for your project: AnyCPU, x86 or x64.Bevan

1 Answers

2
votes

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.