Port from .NET Framework to .NET 6 - .NET Core (2023)

  • Article
  • 7 minutes to read

This article provides an overview of what you should consider when porting your code from .NET Framework to .NET (formerly named .NET Core). Porting to .NET from .NET Framework for many projects is relatively straightforward. The complexity of your projects dictates how much work you'll do after the initial migration of the project files.

Projects where the app model is available in .NET, such as libraries, console apps, and desktop apps, usually require little change. Projects that require a new app model, such as moving to ASP.NET Core from ASP.NET, require more work. Many patterns from the old app model have equivalents that can be used during the conversion.

Windows desktop technologies

Many applications created for .NET Framework use a desktop technology such as Windows Forms or Windows Presentation Foundation (WPF). Both Windows Forms and WPF have been ported to .NET, but these remain Windows-only technologies.

Consider the following dependencies before you migrate a Windows Forms or WPF application:

  • Project files for .NET use a different format than .NET Framework.
  • Your project might use an API that isn't available in .NET.
  • Third-party controls and libraries might not have been ported to .NET and remain only available to .NET Framework.
  • Your project uses a technology that is no longer available in .NET.

.NET uses the open-source versions of Windows Forms and WPF and includes enhancements over .NET Framework.

For tutorials on migrating your desktop application to .NET 6, see one of the following articles:

  • Migrate .NET Framework WPF apps to .NET
  • Migrate .NET Framework Windows Forms apps to .NET

Windows-specific APIs

Applications can still P/Invoke native libraries on platforms supported by .NET. This technology isn't limited to Windows. However, if the library you're referencing is Windows-specific, such as a user32.dll or kernel32.dll, then the code only works on Windows. For each platform you want your app to run on, you'll have to either find platform-specific versions, or make your code generic enough to run on all platforms.

When you're porting an application from .NET Framework to .NET, your application probably used a library provided by .NET Framework. Many APIs that were available in .NET Framework weren't ported to .NET because they relied on Windows-specific technology, such as the Windows Registry or the GDI+ drawing model.

(Video) Port .NET applications from .NET Framework to .NET Core | AWS Events

The Windows Compatibility Pack provides a large portion of the .NET Framework API surface to .NET and is provided via the Microsoft.Windows.Compatibility NuGet package.

For more information, see Use the Windows Compatibility Pack to port code to .NET.

.NET Framework compatibility mode

The .NET Framework compatibility mode was introduced in .NET Standard 2.0. The compatibility mode allows .NET Standard and .NET (including .NET Core 3.1) projects to reference .NET Framework libraries on Windows only. Referencing .NET Framework libraries doesn't work for all projects, such as if the library uses WPF APIs, but it does unblock many porting scenarios. For more information, see the Analyze your dependencies to port code from .NET Framework to .NET.

Unavailable technologies

There are a few technologies in .NET Framework that don't exist in .NET:

  • Application domains

    Creating additional application domains isn't supported. For code isolation, use separate processes or containers as an alternative.

  • Remoting

    Remoting is used for communicating across application domains, which are no longer supported. For simple communication across processes, consider inter-process communication (IPC) mechanisms as an alternative to remoting, such as the System.IO.Pipes class or the MemoryMappedFile class. For more complex scenarios, consider frameworks such as StreamJsonRpc or ASP.NET Core (either using gRPC or RESTful Web API services).

  • Code access security (CAS)

    CAS was a sandboxing technique supported by .NET Framework but deprecated in .NET Framework 4.0. It was replaced by Security Transparency and it isn't supported in .NET. Instead, use security boundaries provided by the operating system, such as virtualization, containers, or user accounts.

    (Video) On .NET Live - .NET Framework to .NET Core Migration

  • Security transparency

    Similar to CAS, the security transparency sandboxing technique is no longer recommended for .NET Framework applications and it isn't supported in .NET. Instead, use security boundaries provided by the operating system, such as virtualization, containers, or user accounts.

  • System.EnterpriseServices

    System.EnterpriseServices (COM+) isn't supported in .NET.

  • Windows Workflow Foundation (WF)

    WF isn't supported in .NET. For an alternative, see CoreWF.

For more information about these unsupported technologies, see .NET Framework technologies unavailable on .NET Core and .NET 5+.


.NET (formerly known as .NET Core) is designed to be cross-platform. If your code doesn't depend on Windows-specific technologies, it can run on other platforms such as macOS, Linux, and Android. Such code includes project types like:

  • Libraries
  • Console-based tools
  • Automation
  • ASP.NET sites

.NET Framework is a Windows-only component. When your code uses Windows-specific technologies or APIs, such as Windows Forms and WPF, the code can still run on .NET but it won't run on other operating systems.

It's possible that your library or console-based application can be used cross-platform without changing much. When you're porting to .NET, you might want to take this into consideration and test your application on other platforms.

(Video) Upgrading from .NET Framework to .NET 6

The future of .NET Standard

.NET Standard is a formal specification of .NET APIs that are available on multiple .NET implementations. The motivation behind .NET Standard was to establish greater uniformity in the .NET ecosystem. Starting with .NET 5, a different approach to establishing uniformity has been adopted, and this new approach eliminates the need for .NET Standard in many scenarios. For more information, see .NET 5+ and .NET Standard.

.NET Standard 2.0 was the last version to support .NET Framework.

Instead of manually porting an application from .NET Framework to .NET, you can use different tools to help automate some aspects of the migration. Porting a complex project is, in itself, a complex process. The tools might help in that journey.

Even if you use a tool to help port your application, you should review the Considerations when porting section in this article.

.NET Upgrade Assistant

The .NET Upgrade Assistant is a command-line tool that can be run on different kinds of .NET Framework apps. It's designed to assist with upgrading .NET Framework apps to .NET. After running the tool, in most cases the app will require more effort to complete the migration. The tool includes the installation of analyzers that can assist with completing the migration. This tool works on the following types of .NET Framework applications:

  • Windows Forms
  • WPF
  • Console
  • Class libraries

This tool uses the other tools listed in this article and guides the migration process. For more information about the tool, see Overview of the .NET Upgrade Assistant.


The try-convert tool is a .NET global tool that can convert a project or entire solution to the .NET SDK, including moving desktop apps to .NET. However, this tool isn't recommended if your project has a complicated build process such as custom tasks, targets, or imports.

For more information, see the try-convert GitHub repository.

.NET Portability Analyzer

The .NET Portability Analyzer is a tool that analyzes assemblies and provides a detailed portability report. It reports .NET APIs that are missing in the applications or libraries to be ported on your specified targeted .NET platforms.

To use the .NET Portability Analyzer in Visual Studio, install the extension from the marketplace.

(Video) Upgrade to .Net6 | How to convert dotnet framework 4 project to dotnet 6 in 2022 (Today)

For more information, see The .NET Portability Analyzer.

Platform compatibility analyzer

The Platform compatibility analyzer analyzes whether or not you're using an API that will throw a PlatformNotSupportedException at run time. Although finding one of these APIs is unlikely if you're moving from .NET Framework 4.7.2 or higher, it's good to check. For more information about APIs that throw exceptions on .NET, see APIs that always throw exceptions on .NET Core.

For more information, see Platform compatibility analyzer.

Considerations when porting

When porting your application to .NET, consider the following suggestions in order:

✔️ CONSIDER using the .NET Upgrade Assistant to migrate your projects. Even though this tool is in preview, it automates most of the manual steps detailed in this article and gives you a great starting point for continuing your migration path.

✔️ CONSIDER examining your dependencies first. Your dependencies must target .NET, .NET Standard, or .NET Core.

✔️ DO migrate from a NuGet packages.config file to PackageReference settings in the project file. Use Visual Studio to convert the package.config file.

✔️ CONSIDER upgrading to the latest project file format even if you can't yet port your app. .NET Framework projects use an outdated project format. Even though the latest project format, known as SDK-style projects, was created for .NET Core and beyond, they work with .NET Framework. Having your project file in the latest format gives you a good basis for porting your app in the future.

✔️ DO retarget your .NET Framework project to at least .NET Framework 4.7.2. This ensures the availability of the latest API alternatives for cases where .NET Standard doesn't support existing APIs.

✔️ CONSIDER targeting .NET 6, which is a long-term support (LTS) release.

(Video) Upgrading from .NET Framework to .NET 7 | .NET Conf 2022

✔️ DO target .NET 6+ for Windows Forms and WPF projects. .NET 6 contains many improvements for Desktop apps.

✔️ CONSIDER targeting .NET Standard 2.0 if you're migrating a library that might also be used with .NET Framework projects. You can also multitarget your library, targeting both .NET Framework and .NET Standard.

✔️ DO add reference to the Microsoft.Windows.Compatibility NuGet package if, after migrating, you get errors of missing APIs. A large portion of the .NET Framework API surface is available to .NET via the NuGet package.

See also

  • Overview of the .NET Upgrade Assistant
  • ASP.NET to ASP.NET Core migration
  • Migrate .NET Framework WPF apps to .NET
  • Migrate .NET Framework Windows Forms apps to .NET
  • .NET 5 vs. .NET Framework for server apps


How do I migrate from .NET Framework to .NET 6? ›

Migrating from .

NET 5. In Visual Studio, simply right click on your project in Solution Explorer and choose Properties. Under Application > General > Target framework, choose . NET 6.0.

Can you migrate from .NET Framework to .NET Core? ›

You can migrate your old project to the Core project using the 'dotnet migrate; command, which migrates the project. json and any other files that are required by the web application. The dotnet migrate command will not change your code in any way.

Is .NET 6 and .NET Core 6 the same? ›

NET 6, though, is ASP.NET Core 6, a major upgrade of Microsoft's open source framework for building modern web applications. ASP.NET Core 6 is built on top of the . NET Core runtime and allows you to build and run applications on Windows, Linux, and macOS. ASP.NET Core 6 combines the features of Web API and MVC.

Can .NET 6 reference .NET Framework? ›

3 answers. You can not use your . NET Framework 4.8 project with your . NET Core 6 project.

Is .NET 6 still .NET Core? ›

While support for . NET Core 3.1 ends in December 2022, support for . NET 6 will continue until November 2024.

Can you mix .NET Framework and .NET Core? ›

You cannot directly reference a . NET Framework assembly from . NET Core or the other way round a . NET Core assembly from .

Why migrate from .NET Framework to .NET Core? ›

NET Core has led to an increase in the number of developers interested in working with it compared to . NET Framework. This is because . NET Core provides a range of advantages that make development easier and more efficient, such as being open-source, cross-platform, modularized, and high-performance.

Can .NET Core and .NET Framework coexist? ›

NET Core is portable, and can be tuned to run across different supported platforms. Depending on how you target your projects, it's possible to have . NET Core code run on the . NET Framework, Mono and Xamarin platforms, on Windows 8 and Windows Phone, and on the Universal Windows Platform (UWP).

What's the difference between .NET Framework .NET core and .NET 6? ›

NET Framework Application Model includes WinForms, ASP.NET, and WPF, used for developing desktop and web apps. In contrast, . NET Core does not support desktop application development, focusing instead on the web, windows mobile, and windows store with ASP.NET and Windows universal apps.

Is .NET 6 backwards compatible? ›

NET Framework 4.5 and later versions are backward-compatible with apps that were built with earlier versions of the . NET Framework. In other words, apps and components built with previous versions will work without modification on the . NET Framework 4.5 and later versions.

Why migrate to net 6? ›

NET 6 is the far better choice between the two frameworks. It runs faster, produces more efficient code, and guarantees long-term support. As such, upgrading from .

How do I migrate from .NET Core 2.1 to 6? ›

If you are in 2.1 and need to go directly to 6, you need to refer the migration website. Refer the documentation from 2.1 to 2.2 till 5.0 to 6.0 and understand the changes you will need to make and apply them.

How do I upgrade .NET Framework 4.5 to 6? ›

Use the . NET Upgrade Assistant to upgrade an existing . NET Framework Windows Forms app to . NET 6.

Should I use .NET Core 3.1 or .NET 6? ›

NET Core 3.1 has succeeded. For new projects, it's recommended to go with the newest and fastest version, . NET 6, since it is the most flexible and performance-oriented version released so far and will work on every scenario and requirement.

Is .NET 6 backwards compatible with .NET 5? ›

NET 5/6/7 are cross-platform, and do not include all the windows-specific code. It can be installed on linux/mac/windows. NET Standard is a set of interfaces that help to guarantee cross-compatibility no matter whether you are running NET Framework or NET 5/6/7.

What is difference between .NET Core and .NET framework? ›

NET Core is written from scratch to make it a modular, lightweight, fast, and cross-platform Framework Whereas, Microsoft's Net Framework is a software development platform for building and running Windows applications.Net framework includes developer tools, programming languages, and libraries that are used to develop ...

Is .NET Core obsolete? ›

NET Core versions no longer supported.

Is .NET Core outdated? ›

The long-term-support (LTS) version 3.1 of Microsoft . NET Core Framework is slated to go out of support on December 13th, 2022. Microsoft recommends upgrading . NET Core 3.1 applications to .

Is .NET 6 better than .NET Framework? ›

NET 6 can run on natively Mac and Linux, . NET Framework cannot and you would need a third-party runtime like Mono for that capability. . NET 6 you can compile the framework into your application so the separate framework does not need to be installed to run your app. .

Is .NET 6 cross-platform? ›

It is a cross-platform framework that allows you to create native mobile and desktop applications for Android, iOS, macOS, and Windows, without having to maintain multiple codebases to support all these different platforms. Microsoft . NET 6 not only establishes a new foundation for all future .

How do I update .NET Framework to .NET core? ›

NET Framework version. To update the target framework for all projects, right-click on the project (one by one), click properties, and from the “Application” tab change the target framework to the desired one as in the following screenshot and select “Yes” in the popup that is displayed after the framework is changed.


1. Porting your app from .NET Framework to dot net core - Lachlan Barclay
(DDD Melbourne)
2. Migrating .Net Framework to .Net 6.0
(Md. Saifullah Al Azad)
3. Migrate Your Legacy ASP.NET Projects to ASP.NET Core Incrementally with YARP | .NET Conf 2022
4. Migrating a Legacy .NET Framework Application to .NET 5 Using Porting Assistant for .NET
(Amazon Web Services)
5. AWS re:Invent 2020: Porting .NET Framework applications to .NET Core on Linux
(AWS Events)
6. Porting ASP.NET from .NET Framework to .NET Core - Part 1 - Database
(Code It Up by AMBITIONED)
Top Articles
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated: 12/28/2022

Views: 5996

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.