Migrating from .NET Framework to .NET Core: A Practical Guide

Published on October 30, 2023

Migrating from .NET Framework to .NET Core (now just ".NET") is one of the most common modernization projects I see. Here's what you need to know before you start.

Why Migrate?

.NET Framework is in maintenance mode. Microsoft isn't adding new features. If you want performance improvements, cross-platform support, or access to modern .NET features, you need to migrate to .NET Core/.NET 5+.

Assessment First

Before touching any code, assess your application:

  • What dependencies do you have? Are they compatible with .NET Core?
  • Do you use Windows-specific APIs?
  • How complex is your codebase?
  • What's your test coverage like?

The Migration Process

1. Upgrade to the latest .NET Framework version - Start with .NET Framework 4.8. This will identify compatibility issues early.

2. Move to .NET Standard where possible - Class libraries can target .NET Standard 2.0, which works with both Framework and Core.

3. Tackle dependencies - Update NuGet packages to versions that support .NET Core. Replace packages that don't have Core versions.

4. Address API differences - Some APIs changed or were removed in .NET Core. You'll need to refactor code that relies on them.

5. Update project files - Move from packages.config to PackageReference. Update .csproj files to the new SDK-style format.

6. Test everything - This is where good test coverage pays off. Test thoroughly at each stage.

Common Gotchas

Web.config is gone in ASP.NET Core. Configuration is now done in code or appsettings.json. The Global.asax file is replaced with Startup.cs. And async/await is now the default pattern for I/O operations.

Timeline and Effort

A simple application might migrate in days. A complex enterprise system could take months. It depends heavily on your dependencies and how much Windows-specific code you have.

Considering a migration? Let's discuss what's involved for your specific application.



Ready to Talk About Your Project?

If you're dealing with any of the challenges discussed in this post, let's have a conversation about how I can help.

Get In Touch