Sergei Tachenov
Sergei Tachenov

Reputation: 24869

The NUnit 3.0 driver cannot support this test assembly

This is intended to be a self-answered question, but if someone can provide a better answer, please do!

I'm trying to get started with NUnit. I installed NUnit 3.4 using the MSI installer, and I also installed the 3.2 test adapter. Then I created a simple project and a separate classes library for unit tests. Then I added a reference to the NUnit framework. The library builds fine, but when trying to run it either through the test adapter or using the command line runner, I get this message:

The NUnit 3.0 driver cannot support this test assembly. Use a platform specific runner.

There are no specific details as to why it cannot support this particular harmless test assembly. The test adapter provides an exception name as well, but it isn't particularly useful either.

Environment details: Microsoft Visual Studio 2013, .Net 4.5.

The question is: what's going on and, most importantly, how to fix it?

Upvotes: 1

Views: 2035

Answers (3)

Gave Drohl
Gave Drohl

Reputation: 93

This error also happened to me but for only 1 out of the 50 test assemblies I had. I fixed it by uninstalling the NUnit NuGet package for the project that failed, and then reinstalled it. The problem it seemed fix was an incorrect Hint Path in the project file. After that was fixed, the test assembly ran without that error.

Upvotes: 0

Rob Prouse
Rob Prouse

Reputation: 22647

I have created an issue for this at https://github.com/nunit/nunit/issues/1646

This was tested with the first NUnit 3.0 release and worked then, but it is likely that newer versions of Visual Studio is resolving references differently.

The workaround is to browse for the version of NUnit that you want instead of selecting it from Assemblies | Extensions. The .NET 4.5 version of the NUnit Framework installs to C:\Program Files (x86)\NUnit.org\framework\{version}\net-4.5 by default.

Upvotes: 2

Sergei Tachenov
Sergei Tachenov

Reputation: 24869

When playing around with references I noticed that no matter what NUnit framework I choose from the list, when I close the project properties window and open it up again, I see a reference to the portable NUnit framework. The tooltip in the references list in the solution manager also shows a path containing the word “portable”. And it seems there is something with this portable framework that the test runner doesn't like.

As I don't need this portable framework, I tried to add the 4.5 framework specifically. It didn't work. No matter what I choose, the portable framework pops up!

So I decided to go the easy way and uninstalled NUnit, then reinstalling it using a “custom” installation with the portable framework deselected. Worked like a charm! Now when I add NUnit framework as a reference, the 4.5 framework is added, and it runs fine using the test adapter, right inside Visual Studio.

If someone knows how to fix it without uninstalling the portable NUnit framework, you're welcome to post another answer!

Upvotes: 2

Related Questions