Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NUnit isn't running Visual Studio 2010 code

I'm trying to load a Visual Studio 2010 beta dll into the NUnit GUI. I get a popup error.

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 build with a later version of the CLR than the version under which NUnit is currently running.

How do I force an executable to run under .NET 4?

like image 806
Ball Avatar asked May 30 '09 19:05

Ball


3 Answers

I've downloaded the NUnit 2.5 source and opened the VS2008 solution in the VS2010 beta. Once the conversion finished I opened all the projects and changed the target framework setting for all the projects to ".NET Framework 4.0". I then built the solution without any errors. I can now use the NUnit GUI app to run tests built for .NET 4.0. I've not done exhaustive testing of this build so there may be problems, but for my purposes it works fine.

Update: It is not necessary to rebuild NUnit. I discovered that if you add the following to the relevant NUnit config file you can run a test dll built for .NET 4.0.

Under <configuration> add:

<startup>
  <supportedRuntime version="v4.0.30319" />
</startup>

and under <runtime> add:

<loadFromRemoteSources enabled="true" />
like image 154
Charles Cook Avatar answered Nov 02 '22 14:11

Charles Cook


With .NET 4 being released, I used

<supportedRuntime version="v4.0.30319" />

in the NUnit 2.5.4 exe.config instead of requiredRuntime, and the loadFromRemoteResources tag as shown above and all worked well. Thanks!

like image 33
pelazem Avatar answered Nov 02 '22 15:11

pelazem


You don't have to modify any file

just open this file and everything will work just fine

C:\Program Files (x86)\NUnit 2.5.10\bin\net-2.0\nunit-x86.exe

like image 17
darky Avatar answered Nov 02 '22 15:11

darky