.NET 5 is Here: The Complete Migration Guide

The wait is over. .NET 5 has officially been released, marking the beginning of the unified .NET platform. This isn’t just another version update; it’s the convergence of .NET Core and .NET Framework into a single, cohesive platform. If you’re running .NET Core 3.1, the upgrade path is straightforward, but substantial.

Coding on laptop
Photo by Ilya Pavlov on Unsplash

The Vision: One .NET

For years, we’ve had to choose: .NET Framework for Windows compatibility, .NET Core for cross-platform microservices, and Xamarin for mobile. .NET 5 starts the journey to unify these. While the full unification (including MAUI) will complete in .NET 6, .NET 5 brings the core runtime, libraries, and SDKs together.

Migration Guide

Migrating from .NET Core 3.1 to .NET 5 is generally smooth. Here is the checklist:

  1. Update Visual Studio: You need VS 2019 16.8 or later.
  2. Update Project Files: Change your TFM to net5.0.
  3. Update NuGet Packages: Upgrade Microsoft.AspNetCore.* and System.* packages.
  4. Check Breaking Changes: There are some, particularly in ASP.NET Core integration testing and serialization.
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <!-- Before -->
    <!-- <TargetFramework>netcoreapp3.1</TargetFramework> -->
    
    <!-- After -->
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
</Project>

Top New Features

  • C# 9.0: Records, pattern matching enhancements, top-level statements.
  • Performance: Massive improvements in JSON serialization, RegEx, and gRPC.
  • Single File Applications: Improved single-file deployment support.
  • Windows ARM64 Support: Native support for Surface Pro X and other ARM64 devices.

Should You Migrate?

If you are on .NET Core 3.1, yes. .NET 5 is current, faster, and has great features. However, note that .NET 5 is a “Current” release (supported for 18 months), not LTS. .NET 6 (LTS) will arrive in Nov 2021. For most active development teams, the performance gains alone are worth the upgrade now.

References


Discover more from C4: Container, Code, Cloud & Context

Subscribe to get the latest posts sent to your email.

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.