Good day everyone. I have been having the same problem all day at work and am struggling to find any new paths to go down.
I am getting the following error when my
Check the target framework version of your assembly are same as nUnit test runner supports. See runFile.exe.config for list of supported runtimes.
Also if you have megrated from FW 3 to FW 4, they has different runtime (CLR is different).
A minor addition to all answers. You might need to change the NUnit runner platform (Resharper for me) itself as it was in my case. See example
I had this problem with a console app on X64 pc, the build was set as x86 and it still crashed. I went into Properties on the Console App and under build I changed my Platform Target from x86 to Any CPU then suddenly all the tests worked and ran successfully.
of note, the Configuration Manager's platform field can "lie" to you and doesn't actually have to reflect what the project's properties are actually configured to do. My configuration manager said that "Common.dll" was being built as "Any CPU", but the project properties (the setting that really matters) was building it as "x86".
My situation was a bit different. The error appeared quite randomly after running a Unit Test that had been modified.
I removed the test and the error went away.
I recreated the test and the error came back.
I renamed the test and the error went away.
I renamed the test back and the problem did not happen again.
Hope this helps!
Ben
This might sound stupid, but, check your project and processor architectures. In my case, I was running 64-bit tests on what I assumed was a 64-bit machine (since it was building 64-bit projects).
Guess what? It was actually a 32-bit machine. So NUnit.exe ran as 32-bit (obviously), and can't understand 64-bit tests.
The solution? Build a x86 and x64 version of your tests, and run the x86 ones on the x86 machines, and the x64 ones on the x64 machines.
Obvious. But worth checking out.
Make sure that this setting is correct: Test menu -> Test Settings -> Default Processor Architecture -> x64 / x86. It was incorrect in my case and it failed with the same issue.