No tests are showing up in the test explorer after I added a .NET standard library to a .NET framework 4.6.1 web api 2 project. (I am using MSTest)
If I remove the .NET standard library and all the app & web config changes it made when I added it, the tests show up again.
My solution consists of:
- Project A - .NET 4.6.1 web api referencing a .NET standard library
- Project B - .NET 4.6.1 unit test project; referencing A
What I did:
- Added .NET standard lib to my webapi 2 project (Project A)
- Followed this microsoft article (last step) and enabled automatic binding redirects in web apps
- This added alot of assembly redirects in my main web.config and in the app.config of my unit tests project.
- Following this github thread, I added the following to my unit test project (Project B):
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
I didn't enable PackageReference as mentioned in the github issue but my WebAPI project works fine. Its just that my unit tests have dissappeared from the test explorer.
I tried the solution from this question, but that hasn't helped.