I’m getting an error from each of my xUnit test projects that there is a package downgrade from Microsoft.NETCore.App from 2.0.9 to 2.0.0.

Alt

I tried isolating the issue to one project so I unloaded all the test projects in my solution. Then I tried upgrading the version of .NET Core from v2.0 to v2.1. However that produced the following error:

Alt

My project dependencies are lit up:

Alt

The projects are as follows:

Project Description Framework
MyApplication.Actor Concrete implementation of my actor .NET Core 2.1
MyApplication.Actor.Interfaces Actor interface .NET Core 2.1
MyApplication.Actor.Mocks Mock implementation of my actor (for unit testing purposes) .NET Core 2.1
MyApplication.Actor.Model Domain Model implementation for my actor .NET Standard 2.0
MyApplication.Actor.Tests Unit Tests for my actor .NET Core 2.1

It looks like the Service Fabric version is what is killing me. So I removed all the Service Fabric assemblies (and ServiceFabric.Mocks) to try and get the project to be identical to my known good project.

Alt

Still can’t update the Test SDK to 15.8.

If I open the two project files and take a look the only difference is the version of the .NET Test SDK. The broken project is still referencing 15.7.0 while the clean new project is referencing 15.8.0.

Alt

However there is one small difference. XUnit is being referred to using a “DotNetCliToolReference” instead of a “PackageReference”. When I make the change it finally works.

After I got that working I ran into some compile time errors:

CS0246 The type or namespace name ‘RemotingListener’ could not be found (are you missing a using directive or an assembly reference?)

CS0103 The name ‘RemotingListener’ does not exist in the current context

CS0246 The type or namespace name ‘RemotingClient’ could not be found (are you missing a using directive or an assembly reference?)

CS0103 The name ‘RemotingClient’ does not exist in the current context

Alt

Changed to this:

Alt

With this small change I was able to get one of my actors building. Now I just need to update all the rest!

However, I still get the same error yet its now incremented the version downgrade from 2.1.3 to 2.1.0! Oh the insanity!

Alt

My actor is now showing as .NETCore.App v2.1.3. where as my other actors are showing v2.0.9 as you can see below:

Alt

The problem is when the test project references a.NET Core project. When I add a project reference to my control test project I get the same error as my old unit test project.

Maybe I need to update XUnit?

Alt

So after a bit more digging I found this thread on GitHub that lead to me actually solving the problem.

Alt

Of course, replaysMike probably had his .NET Core projects reporting v2.1.2 while mine have since incremented to v2.1.3. Low and behold, when I applied the change by editing the configuration as follows:

Alt

It worked! My dependencies updated with a reference to .NET Core v2.1.3.

Alt

So to recap, the steps I had to follow were:

  1. Remove all references to any .NET Core projects (which was causing the downgrade)
  2. Update Nuget references for XUnit framework from v2.3.1 to v2.4.0
  3. Update the project file with the Runtime Framework Version of v2.1.3
  4. Rebuild

And it worked just like magic. Looking back, I probably didn’t need to go through all the trouble of updating my version of Service Fabric / .NET Core / etc but after I did all the work, I’m not reverting!

Sigh…Guess we will never be rid of DLLHell 😊