Chapter 7. Migration from previous versions of .NET
7.1. Migration from previous versions of .NET
Microsoft provides instructions for migrating from most previous versions of .NET Core.
If you are using a version of .NET that is no longer supported or want to migrate to a newer .NET version to expand functionality, see the following articles:
- Migrate from ASP.NET Core 5.0 to 6.0
- Migrate from ASP.NET Core 3.1 to 5.0
- Migrate from ASP.NET Core 3.0 to 3.1
- Migrate from ASP.NET Core 2.2 to 3.0
- Migrate from ASP.NET Core 2.1 to 2.2
- Migrate from .NET Core 2.0 to 2.1
- Migrate from ASP.NET to ASP.NET Core
- Migrating .NET Core projects from project.json
- Migrate from project.json to .csproj format
If migrating from .NET Core 1.x to 2.0, see the first few related sections in Migrate from ASP.NET Core 1.x to 2.0. These sections provide guidance that is appropriate for a .NET Core 1.x to 2.0 migration path.
7.2. Porting from .NET Framework
Refer to the following Microsoft articles when migrating from .NET Framework:
- For general guidelines, see Porting to .NET Core from .NET Framework.
- For porting libraries, see Porting to .NET Core - Libraries.
- For migrating to ASP.NET Core, see Migrating to ASP.NET Core.
Several technologies and APIs present in the .NET Framework are not available in .NET Core and .NET. If your application or library requires these APIs, consider finding alternatives or continue using the .NET Framework. .NET Core and .NET do not support the following technologies and APIs:
- Desktop applications, for example, Windows Forms and Windows Presentation Foundation (WPF)
- Windows Communication Foundation (WCF) servers (WCF clients are supported)
- .NET remoting
Additionally, several .NET APIs can only be used in Microsoft Windows environments. The following list shows examples of these Windows-specific APIs:
-
Microsoft.Win32.Registry
-
System.AppDomains
-
System.Drawing
-
System.Security.Principal.Windows
Consider using the .NET Portability Analyzer to identify API gaps and potential replacements.
For example, enter the following command to find out how much of the API used by your .NET Framework application is supported by .NET 5.0:
$ dotnet /path/to/ApiPort.dll analyze -f . -r html --target '.NET Framework,Version=<dotnet-framework-version>' --target '.NET Core,Version=<dotnet-version>'
Replace <dotnet-framework-version> with the .NET Framework version you are currently using. For example, 4.6. Replace <dotnet-version> with the version of .NET Core you plan to migrate to. For example, 3.1.
Several APIs that are not supported in the default version of .NET may be available from the Microsoft.Windows.Compatibility NuGet package. Be careful when using this NuGet package. Some of the APIs provided (such as Microsoft.Win32.Registry
) only work on Windows, making your application incompatible with Red Hat Enterprise Linux.