VS2017 cannot discover MSTest tests

7

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.

c#
visual-studio-2017
mstest
asked on Stack Overflow Jul 26, 2017 by wasabi

3 Answers

7

I had upgraded some of the projects to 4.6.2 and two of them had app.config files with specific assembly bindings.

Deleting both the app.config files fixed the problem for me - there were no other settings being used in the files so I just deleted rather than fixing the bindings.

answered on Stack Overflow Sep 18, 2017 by Andy Cook
1

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

answered on Stack Overflow Oct 4, 2017 by Saravanan • edited Oct 5, 2017 by Saravanan
0

In my case an error in my app.config xml format prevented to discover and run tests on that test project.
It is actually weird though, that the error was this one instead of malformed configuration...

answered on Stack Overflow Apr 15, 2018 by Eugenio MirĂ³

User contributions licensed under CC BY-SA 3.0