Skip to content

Migrating from .NET Framework to .NET Core

Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Migrating from .NET Framework to .NET Core

Over the course of several years, I’ve been slowly migrating a 5-year-old system built on top of .NET Framework (v4.8). In this blog series, I’m going to describe each step of the migration, as there were many, in order to get the system running entirely on .NET Core. This is series intended as a guide for Migrating from .NET Framework to .NET Core.

This wasn’t a “big bag” migration, but rather a series of steps that were taking over the course of years. That’s not to say your migration will take as long.

System Background

In order to get a sense of the undertaking and for hopefully relating it to the system you might be migrating, it’s worth me describing my system at a high level.

The system is a modular monolith. It’s comprised of multiple projects that each contain specific business functionality. Each project is a boundary for that functionality. There are two main entry points, a web application and a worker.

Web Application

The primary interface is an HTTP API that is accessed via a web/typescript frontend, mobile app, and C# clients. This interface was originally developed using the Katana (OWIN). Primarily all HTTP APIs were developed using Nancy, however, there was a sprinkled amount of ASP.NET WebAPI and OData.

This project was self hosted using Katana’s HTTPListener in a console application. It was not hosted with IIS.

This is project is important to note because it did give us a head start. Project Katana is a precursor to ASP.NET Core before I really knew it. There are many similarities in how you configure your web application such as the Startup, configuring Middleware, etc.

Worker / Queue Processing

The other part of the system is processing messages from a queue in a console application. These messages are generally created by the web application, however, this application does publish it’s own jobs to the queue.

Ultimately this application is just another entry point/interface to the application. They are the only two executables in the system. They both reference the exact same projects that contain the actual business functionality of the system. Both the worker and web application are thin projects that only contain code to set up for their respected interfaces, HTTP and message queues.

Migration

This series will cover the following topics in migrating this system. Again, some might be applicable to you, some may not. Hopefully, some of these topics will help you in migrating from .NET Framework to .NET Core.

ASP.NET Core

Migrate from Katana (OWIN) to ASP.NET Core. This is actually pretty straight forward in terms of moving custom middleware over or if you’re coming from Web API.

Base Class Library

What types you may be used in the .NET Framework Base Class Library that do not exist in the .NET Core Base Class Library. How you can find these missing types via the Compatability Analyzer and if there are replacements. The biggest hurdle here is generally any type residing under System.Web

3rd Party Dependencies

There are two aspects to 3rd party dependencies via NuGet for migration:

  • .NET Core and/or .NET Standard Support
  • API Surface

The last point is the tricky one. Just because you’re using a NuGet Package on .NET Framework, that has the same version that targets .NET Core or .NET Standard does not mean that package, even though its the same version, will have the exact same APIs available.

Entity Framework (Core)

One large dependency for most projects is Entity Framework. Migrating to Entity Framework Core might not be feasible, but there are options for running your existing Entity Framework 6.x code on .NET Core.

Migrating from .NET Framework to .NET Core

Follow along on this blog series as I cover the above discussion points and how I managed to Migrate. If you’ve done a migration, please let me know in the comments below about any pain points you had as I may have also had them but forgot to mention them here.

Blog Post Series

Related Links

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Leave a Reply

Your email address will not be published. Required fields are marked *