VS2017 cannot discover MSTest tests

Viewed 2133

I've been having this recurring problem with some of my .Net framework 4.5 and 4.6 and 4.7 projects not having their tests discovered by test explorer. The "tests" log output is showing:

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

That's all the info I have.

I've tried pretty much every combination of the different version of MSTest.Framework and adapter and such. Just can't figure this one out. I've done the Test Extension cache clearing.

3 Answers

I got the same issue. I am using VS 2017 and .Net Version 4.7. Though I made test runnable by adding Visual Studio Quality Tools and by removing MSTest framework and adapter packages, I am getting other issues like "Could not load System.Runtime"

Update: In my case, the root cause of getting this issue was deleting the <Target> tag in the test project's .csproj file. I got missing file nuget package error and resolved that issue as suggested here. Unfortunately it has a side effect that made my test methods non discover-able

Related