MikeTheTall
MikeTheTall

Reputation: 3603

NUnit on Visual Studio 2017 (Enterprise): Test Runner only works as Extension, not Solution NuGet package?

My problem is very similar to NUnit Unit tests not showing in Test Explorer with Test Adapter installed, in that I couldn't get the NUnit tests to appear in the Test Explorer (despite multiple rebuilds, setting the Test architecture to x64, etc). I rebuilt and rebuilt, and despite having NUnit 3 and the NUnit 3 Test Runner installed into my Solution (via Tools -> NuGet Package Manager -> Manage NuGet Packages For Solution...) I couldn't get the tests to appear.

On the advice of another response to the above question, I installed the NUnit 3 Test Runner as an Extension (which modified all of Visual Studio, not just my project).

After the extension is installed (and I do Yet Another Rebuild :) ) all my tests are listed in the Test Explorer.

Question: Why do are the tests shown in the Test Explorer for the Visual Studio-wide NUnit 3 Test Runner Extension, but NOT in the Solution-specific NUnit 3 Test Runner NuGet package?

What's even weirder is that the exact same project, with the per-Solution NuGet packages for NUnit, work just fine on my personal computer (WITHOUT the NUnit Extensions installed), using Visual Studio 2017 Community edition. It's only when I .ZIP the project and email it to another computer (which runs Visual Studio 2017 Enterprise) where I have this problem.

I'd prefer to install NUnit into the solution so that I can hand out copies to my students and have the project be completely self-contained.

Does anyone have any advice on how to further dig into the problem with the per-Solution NuGet package? I'm kinda stymied since the only obvious thing to try is "rebuild it again and see if that helps" :), so any thoughts on stuff to try / strategies to use would be great.

Upvotes: 1

Views: 532

Answers (1)

MikeTheTall
MikeTheTall

Reputation: 3603

At this point it looks like the Virtual Machine that I'm running the tests in thinks that the project is being run from a network drive. .Net has different rules for running code remotely and by default doesn't want to execute remote code (which seems reasonable :) ).

It's worth pointing out that NUnit should (and does!) work just fine in a VM where the project is saved onto a virtual disk - it's just the 'network drive'/file share that's causing the problem.

Upvotes: 1

Related Questions