Search code examples
assembliesnunit.net-4.0assembly-resolution

Why does trying to unit test with two .NET 4.0 assemblies under NUnit 2.5.4 fail?


I have an MSBuild script that uses NUnit to run tests in two assemblies. These were on .NET Framework 3.5 and it worked perfectly for a long time.

The command line was: (actual paths & names simplified)

nunit-console tests1\bin\debug\tests1.dll tests2\bin\debug\tests2.dll

I've upgraded to VS2010 and have now made the two test assemblies target .NET 4.0. I've also upgraded to NUnit 2.5.4.

I can unit test a single assembly with the following:

nunit-console tests1\bin\debug\tests1.dll /framework=4.0.30319

It works fine with either tests1.dll or tests2.dll.

If I try to specify both like before, it now fails.

nunit-console tests1\bin\debug\tests1.dll tests2\bin\debug\tests2.dll /framework=4.0.30319

The error is:

Could not load file or assembly 'tests2' or one of its dependencies. The system cannot find the file specified.

I've had a look in fuslogvw and it shows tests2 being searched for in the tests1\bin\debug and nunit-console folders. It never searches tests2\bin\debug even though it's specified on the command line.

What's up with that?


Solution

  • Pure guesswork, but it sounds like a regression in the new version of NUnit.

    You're varying two things at once - have you tried running the tests with the older version of NUnit that worked previosuly? That should give you a clue as to which way the problem lies.