Migrating an Azure Service Fabric Service from .Net Framework to .Net core

Migrating an Azure Service

In pursuit of keeping our analytics engine as efficient as possible, my team consistently makes infrastructure updates to prevent our tech from getting stale. To that end, Axonize has been upgrading some of our services from “.Net Framework” to “.Net Core”.

One such group of services resides on the Azure Service Fabric platform. We were a bit concerned about this group having a rough migration, but the process did not end up being difficult aside from some quick fine-tuning.

This blogpost should serve to help others who are migrating or may have concerns about trying.

The good news is that the ServiceFabric projects (The ones with sfproj) will not need to be changed at all. They are just pointers to the service projects themselves and will work as long as your service is configured correctly.

The first step is to make sure that the projects have their package references in the csproj file and not the “packages.config” file. This change is still compatible with .Net Framework, so the solution should still compile after it.

The way to do this is to right click on the project file and choose “Migrate packages.config to PackageReference. You’ll want to do this for all non-sfproj projects.

How to migrate an Azure Service Fabric

After you make sure this compiles, you’ll proceed to the next stage.

Now we can start to edit the csproj files.

Right click on the project of your service fabric service and choose ‘Unload Project.’ Then right click again and choose Edit .csproj.

Now you’ll need to remove everything except for your project references and your package references and add this for the Service Fabric to work:

When its all together the file should look like this:

Now save the csproj and reload the project.

Finally, remove the AssemblyInfo.cs file in your project and build it.

Assuming your nugets are all .net core compatible, it should now be building successfully and will also work on your Service Fabric cluster.

Note: If your nuget packages are not restoring you may have to update them to make sure they support .net standard.

Hopefully, these guided instructions will help you to migrate your services as well.

envelope-subscribe-icon
Don't miss out on the latest
Get notified on Industry updates. We promise not to spam