70

When I updated Visual Studio to the latest version, 1 of my test projects stopped running tests and outputted this message:

Test project {} does not reference any .NET NuGet adapter. Test discovery or execution might not work for this project. It is recommended to reference NuGet test adapters in each test project in the solution.

UPDATED: I was using MS Test as opposed to any other test frameworks like Nunit or Xunit.

14 Answers 14

68

I had to add the following Nuget packages:

MSTest.TestAdapter MSTest.TestFramework Microsoft.NET.Test.Sdk 

Visual Studio release notes

Sign up to request clarification or add additional context in comments.

2 Comments

this worked for me but I had to restart VS as per @user5611634 answer
I also changed from .netstandard2.0 to .netcore3.x as Target framework
54

Ok, you can add Nuget packages as asked. But you can also try to disable the following setting (Tools->Options->Test): "For improved performance, only use test adapters in test assembly folder or as specified in runsettings file".

Let me know if it works for you.

4 Comments

Installing the packages did not work, but changing that test setting did. Thanks.
This worked for me. I think it should be integrated in the accepted answer, because it provides the easier solution and the decision between best performance or the easiest solution is up for the user.
Why stackoverflow shows this answer after all the wrong ones? I lost 10 minutes installing nuget pkg I don't need
I cant find this setting. VS2022
34

If you are using MS Test, try installing

MSTest.TestAdapter via nuget or

if you are using nunit, install

NUnit3TestAdapterlatest versions via nuget.

After installing please restart the visual studio and then you can see the tests running.

4 Comments

After installing please restart the visual studio and then you can see the tests running - Thanks for this important info. I was puzzled why my addition of the nuget packages was not working but the restart is required.
Restarting is really the key!
Installed this package, restarted VS, still the same issue. Had to install Microsoft.NET.Test.Sdk as well as per the accepted answer.
For xUnit projects I had to install the xunit.runner.visualstudio nuget package for my test project.
27

I had the same issue and none of the answers above worked. Installing NUnit3TestAdapter V3.10.0 fixed it.

4 Comments

This was the only answer which worked for my project - I was using Nunit 3 tests rather than MSTest.
This worked for me too. You are correct - you need to install the test adapter or the tests will not run. Thanks.
I added the latest version.
Latest versions didn't work for me. Installed versions 3.10.0 for both worked for me. So thanks!
15

I had a very similar issue recently with xUnit, the same outcome, however my fix was due to the fact that previously with lower versions of Microsoft.NET.Test.Sdk you didn't need XUnit.Runner.VisualStudio explicitly installed.

When I updated my Microsoft.NET.Test.Sdk to version 15.9.0 it stopped allowing tests to run until I installed the XUnit.Runner.VisualStudio Nuget.

Now, This may seem blatantly obvious, but, previously it would cope without it and still work. Now, it does not. The same will probably be true of other test platforms. It worked for me.

2 Comments

same for my project using xUnit
I had to install xunit.runner.utility on Rider.
1

My reputation score does not currently allow me to add this as a comment to the accepted answer. For reference, I've appended version numbers to the nuget packages referenced in csharpsql's answer:

MSTest.TestAdapter v1.3.2 MSTest.TestFramework v1.3.2 Microsoft.NET.Test.Sdk v15.9.0 

Comments

0

I know that it is stupid, but for me nothing from earlier answers were working. After that I just restart my computer and everything is working correctly :) (My proble was that one day everything was working correctly and next day it stopped working)

Comments

0

For me I felt very foolish after spending hours, trying EVERYTHING, only to find that I had simply forgotten to add the [TestMethod] directive on the unit test method.

Comments

0

I was trying to run an existing project. I had the .NET Core SDK 3.3 installed, but did not have 2.1 installed. This was causing the tests to silently fail.

Comments

0

I ran into this problem too (in VS 2019), which can be found all over the web. I also support @csharpsql's simple solution. I also couldn't directly comment (how annoying Stack Overflow!)

I had used 'Remove unused references' in VS. I did have to restart VS to get the references removed from view. Cleaning and rebuilding posed no problem.

But running all tests from the Test Explorer reported 'Not run' on all tests, without any explanation or error message. Very annoying.

After finding the suggestion here I started experimenting with re-adding the latest versions of those 3 references. That solved my problem. I just remains annoying this unnecessary problem occurs!

Comments

0

It helped to install xunit.runner.visualstudio 2.5.6 in Visual Studio 17.9.

Comments

0

For xUnit install these 3 packages:

  • 1. xunit

  • 2. xunit.runner.visualstudio

  • 3. Microsoft.NET.Test.Sdk

Comments

-2

Since its just a checkbox, Ive tried disabling the following setting before anything else, and it worked!

Tools -> Options -> Test -> "For improved performance, only use test adapters in test assembly folder or as specified in runsettings file"

1 Comment

Same as Bennie's answer
-4

Adding NuGet packages doesn't work for me.

Disable the following setting (Tools->Options->Test): "For improved performance, only use test adapters in test assembly folder or as specified in runsettings file" works.

1 Comment

Same as Bennie's answer

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.