Could not load file or assembly NUnit

2.2k Views Asked by At

We have a C# application written in C# and recently switched over from MbUnit to NUnit, I am the only one with an issue where upon running any tests I get a Could not load file or assembly exception for every test. The test seems to start up fine but a call to OpenMappedExeConfiguration is failing even though the path and filename are correct. I'm out of ideas as I have done a clean checkout of the codebase and I still get the same issue.

2

There are 2 best solutions below

0
On BEST ANSWER

Turns out that with NUnit I had inadvertently created a new project and added my Test assembly to the project. It works once you select open project and simply select the Test assembly. What also worked is running each Assembly in a separate AppDomain, this fix works because the AppDomain was present inside of NUnit so it could not find my custom assemblies.

2
On

Open your development environment and attach your debugger to the NUnit running process. Tune the debugger to stop on thrown exceptions (for MSVC Debug -> Exceptions -> Check 2nd and 3rd boxes). Then the solution to the problem should be clear: which dll is exactly not found.