I had a weird one today, some things should just work but they don't and I was creating a brand new unit test project in DotNet core to test a DotNet core api controller. I added NUnit, added a simple test and when I tried to run it, it showed as ignored.

I added another even simpler test that did nothing and the same thing happened.

I then found appalling complicated complaints about the various combinations of NUnit, VSTest, DotNet Core and basically my heart sank as I thought I was fighting a losing battle against something that really should just work.

The main issue was around the various strange error messages, which did not make any sense to me and included:

  • test case objects missing for the following elements
  • ignored: vstest test-case is missing
I tried to disable resharper and use VSTest and restarted Visual Studio (it is sad that this is still a solution since unless people can say why it works, it is just a time waster - caching should work and if there are too many ways to invalidate it then it should be removed)

Anyway, after one of my combinations, I noticed a message telling me there was an error and to look in the test output window. I assumed they meant the output window (they did) and then I saw this: 
  • Testhost process exited with error: It was not possible to find any compatible framework version
    The specified framework 'Microsoft.AspNetCore.App', version '2.2.5' was not found.
This is another error that us normal devs should not see and I wouldn't have understood what the problem was except I recalled an earlier blog post about using dotnet core with NUnit here where I remembered he mentioned editing the project file and removing the value of Version for the nuget reference for Microsoft.AspNetCore.App! Yes really.

I did this and finally everything cranked back into life.

It's these basics that I often moan about because somebody with less experience than me would have bailed a long time before I did. I was only committed because I had already built the target project and need unit tests. If I didn't, I would simply tell everyone that .Net is a nightmare and the MS teams seem unable to keep the quality in their releases.