Reputation: 865
I'm doing a dotnet test but I have this error:
Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate.
Upvotes: 5
Views: 7770
Reputation: 978
I tried many options but I managed to fix this issue by downgrading the version of Microsoft.NET.Test.Sdk to 15.9.0
Upvotes: 0
Reputation: 179
I've had the same error because I was trying to run dotnet vstest
against MyProject.Tests\bin\Debug\net5.0\ref\MyProject.Tests.dll
instead of MyProject.Tests\bin\Debug\net5.0\MyProject.Tests.dll
.
Upvotes: 0
Reputation: 29
Change your test project's target framework other than "net-standard",
"Microsoft decided that your tests should be compiled to target a platform so they know which platform to run your tests under and you get the behavior you expect for the platform you are targeting"
https://github.com/nunit/docs/wiki/.NET-Core-and-.NET-Standard#why-cant-my-tests-target-net-standard
https://github.com/nunit/dotnet-test-nunit/issues/122
Upvotes: 2