top of page

How to Migrate Old ASP.NET Applications to .NET Core?

.NET Core is a new version of .NET Framework, which is a free, open-source, general-purpose development platform maintained by Microsoft. It is a cross-platform framework that runs on Windows, macOS, and Linux operating systems. .NET Core Framework can be used to build different types of applications such as mobile, desktop, web, cloud, IoT, machine learning, microservices, game, etc.

Reason for Migration:

It is easy to migrate most of the front-end codes to ASP.NET Core with minimal changes as they’re client-side code because it comes with a cross backend technology. For the backend code migration, one needs to understand how much is the application coupled with IIS and Windows.

1. Cross-Platform Support

ASP.NET Core development offers cross-platform support which was not possible in previous .Net versions. Developers can build apps for Windows, Mac, and Linux platforms and it can be used to build cloud and IoT applications with modern architecture.

2. Better Performance And Scalability

This framework is enhanced to offer better performance, speed, and efficiency. With modern architectural concepts like containerization and microservices, scalability is not a problem as .Net Core is designed to manage apps built with hundreds of microservices or technology like Docker.

3. Faster Time-To-Market And Secure

Modular architecture, Razor Pages, powerful UI components, regular updates, wider community support, secure processes, easy integration of client-side frameworks, lightweight, cloud-ready, and built-in dependency injection – these make development faster and allow businesses to leverage continuous development and deployments.

Steps to Migrate Old ASP.NET to ASP.NET Core

Step 1: Retarget all projects you wish to port to target .NET framework 4.7.2 or higher. When .Net Core doesn’t support a specific API, this step makes sure that you can use alternative APIs for .Net Framework-specific targets.

Step 2: Use .Net Portability Analyzer. This tool analyzes assemblies and tells if they’re portable to .Net Core.

Credit: Microsoft

Step 3: Install the .NET API analyzer to identify APIs that throw PlatformNotSupportedException on some platforms and identify other potential compatibility issues.

Step 4: Convert all of your packages.config dependencies to the PackageReference format with the conversion tool as packages.config doesn’t work on .NET Core.

Step 5: .Net Core uses a simplified project file format than the .NET framework so you need to create new projects for .NET Core and copy source files or convert your existing files with a tool.

Step 6: It’s advisable to port your test code: Porting is one such significant change that can cause damage if things don’t go well. It is highly recommended to port your test project and run/test the code.

Tips to migrate ASP.NET to ASP.NET Core

  1. You can try smaller modules/projects instead of moving a whole codebase to the .Net Core.

  2. dotnet try-convert tool helps you convert your project to the .Net Core but it is not a guaranteed solution and it may cause subtle changes in behavior. You can use it as a starting point to automate basic things.

  3. Identify the “base” of the library. It could be the data models or classes and methods that are essential. Copy the base into a new .NET Core project. Make any changes needed to compile the code. Copy another layer of code and repeat it.

  4. .NET Core developers can also use the open-source code editor of Microsoft called Visual Studio (VS) code which is supported across all leading OS systems -Windows, Linux, and macOS.

Advantages of .NET Core

  1. ASP.NET Core is compatible with Windows, macOS and Linux. It also can be run on other OS (Operating Systems).

  2. It is fairly easy to create API to connect front-end and external systems and keep your API documentation updated.

  3. Scaling application on load is easy. The application can be run in Docker. It simplifies containerization, scaling, and creating infrastructure for microservice architecture.

  4. The .NET Core platform is open sourced. Any developer can contribute to a framework that boosts framework development speed and improves general quality.

  5. ASP.NET Core provides excellent support for utilizing asynchronous programming patterns.

  6. Visual Studio Intellisense helps to support the project code base. It simplifies new developers involvement and makes their start with a project quite smooth.

  7. .NET Core is supported by Microsoft. The support of a reliable company guarantees that long term investments in .NET based applications are safe and reasonable.

Disadvantages of .NET Core

  1. Windows Forms and WPF applications are not supported in .Net Core.

  2. .Net Core does not support WCF.

  3. ASP.NET Web Pages and ASP.NET Web Forms are not there in .Net Core.

  4. Partial support for VB .NET and F#.

  5. There are no plans to bring WF/WCF+WF/WCF Data Services to .NET Core yet.

  6. 3rd-party library support and some features are missing in .NET Core.

  7. You need to access Windows-specific APIs. If your application needs to work with the Windows Registry, WMI, or other Windows-specific APIs, it won’t work with .NET Core.

When to Use .NET Core?

You should use .NET Core when:

  • There are cross-platform needs. Use it when the application needs to run across multiple platforms such as Windows, Linux and macOS. Those operating systems are supported as development workstations (and the list of supported operating systems is growing):

    • Visual Studio is compatible on Windows with a new limited version on macOS

    • Visual Studio Code can be used on Windows, Linux and macOS

    • All supported platforms allow the use of the command line

  • Using Microservices. Microservices, a form of service-oriented architecture, are software applications consisting of small, modular business services. Each service can run a unique process, be deployed independently and be created in different programming applications. .NET Core allows a mix of technologies, is lightweight and scalable for each microservice

  • Working with Docker containers. Containers and microservices architecture are often used together. Because it is lightweight and modular, .NET Core works very well with containers. You can deploy cross-platform server apps to Docker containers. .NET Framework works with containers, but the image size is larger

  • You have high-performance and scalable system needs. Microsoft recommends running .NET Core with ASP.NET Core for the best performance and scale. This becomes important when using hundreds of microservices. In such a case, a lower number of servers and virtual machines is best. The efficiency and scalability gained should translate to a better user experience in addition to cost savings

  • You are running multiple .NET versions side-by-side. To install applications with dependencies on different versions of frameworks in .NET, developers need to use .NET Core. Multiple services are executable on the same server with different versions of .NET

  • You want command line interface (CLI) control. Some developers prefer working in lightweight editors and command line control. .NET Core has a CLI for all supported platforms and requires minimal installation on production machines. And, there still is the opportunity to switch to an IDE, such as Visual Studio IDE

When Not to Use .NET Core?

Consider the following scenarios:

  • Windows Forms and WPF applications are not supported – You still have to use Mono to make a .NET desktop application for macOS

  • ASP.NET WebForms don’t exist – Though Microsoft provides strategies for migrating ASP.NET Web Forms apps

  • You need to create a WCF service – .NET Core does not currently support WCF. Instead, you would need to make a REST API with ASP.NET Core MVC

  • Missing 3rd-party library support – .NET Core provides a compatibility shim between .NET Framework and .NET Core. But, you may still have issues with compatibility if the class library uses any .NET Framework APIs that are not supported (though this will help bridge a lot of class libraries to .NET Core)

  • Missing .NET Framework features – Some .NET Framework functionality is still missing in .NET Core. For example, Entity Framework Core is not the exact same as Entity Framework v6

  • You need to access Windows-specific APIs – If your application needs to work with the Windows Registry (WMI or other Windows specific APIs), it won’t work with .NET Core. It is designed to be more sandboxed away from the OS

  • Partial support for VB.NET and F# – Microsoft and the community continue to work on this but it’s not yet 100%

The Tech Platform

bottom of page