What, Why, and How to Migrate to .NET Core

December 5, 2019 Arnoldo Perozo

What, Why, and How to Migrate Apps to .NET Core

With the recent announcements from Microsoft about .NET Core and .NET Framework, you may wonder whether you should start planning to migrate to .NET Core. In this article, we will cover which of your existing applications to migrate, what support tools are available, and how to successfully plan and complete your app migration.

Interested? Great, but let’s start from the beginning: what is the difference between .NET Core and .NET Framework?

.NET Core vs .NET Framework

.NET Core is an open-source, multi-platform framework, and it currently focuses mainly on Web applications (ASP, .NET, MVC, API). For Microsoft, .NET Core is the future. With the planned release of a unified platform in 2020, .NET Core will replace .NET Framework. You will be able to use it to target Windows, Linux, macOS, iOS, Android, tvOS, watchOS, WebAssembly, and more. Interestingly, .NET Core and .NET Framework are both platforms and frameworks. The platform part refers to the runtime and compiler, while the framework part refers to the code library. 

.NET Core features many improvements over .NET Framework.

.NET Core .NET Framework
Cross-platform (OS platform): runs on Windows, Linux, and macOS Runs on Windows
Installation is standalone and side-by-side. You can run different versions of .NET Core for different applications on the same computer All applications on a single computer run on the same .NET Framework version
High performance: improvements over .NET Framework in Collections, Math, Regex, Strings, Files, and more High compatibility
Open Source: part of the .NET Foundation and generally licensed under either an MIT or Apache 2 license Compatible with the widest range of NuGet packages, third-party libraries, and internal libraries
v2.0 implements .NET Standard 2.0¹ v4.6.1+ implements .NET Standard 2.0

Should I Migrate to .NET Core? 

You might be wondering, “Do I really need to migrate? What’s in it for me?” Let’s explore some of the advantages of .NET Core you should consider.

.NET Core Advantages
Cross-platform support If your application needs to run across multiple platforms such as Windows, Linux, and macOS, .NET Core will be the better option. .NET Core’s command line interpreter (CLI) can be used on all supported platforms.
Service-oriented architecture Applications comprised of small, modular business services can run as unique processes, deployed independently. .NET Core allows a mix of technologies, is lightweight, and can be minimized for each microservice. .NET Core is also scalable as new microservices are added. Containers and microservices architecture often are used together because of their lightness and modularity. .NET Core works very well with containers. Server apps can be deployed cross-platform to containers (like Docker).² 
Performance and scalability Microsoft recommends running .NET Core with ASP.NET Core for the best performance and scale. This becomes important when hundreds of microservices could be used. A lower number of servers and virtual machines should be needed. The efficiency and scalability gained could translate to a better user experience in addition to cost savings.
Multiple .NET versions side-by-side Multiple services can be run on the same server (host) with different versions of .NET (dependencies on different versions of frameworks in .NET). 

What and How Should I Migrate?

Once you’ve decided that migrating to .NET Core suits your needs, your next question will likely be, “Can I migrate all of my apps? How do I get started?” The answer lies in the type of apps you have. When you’re considering app migration, we recommend that you analyze your apps using the appropriate tools, such as .NET Framework Compatibility Diagnostics or API Portability Analyzer.

Here’s a quick overview of how migration differs by app type and the support you can expect to find:

App type Level of effort Supporting tools/documentation
Web apps: back-end and front-end apps in ASP.NET MVC Simple Detailed Microsoft guide available
Web apps with WebForms Not currently feasible May be able to port instead; see this blog
Windows apps (Universal Framework) No migration needed
Windows apps (Sliverlight-based) Simple Tool available; see this tool
WPF and WinForms desktop apps Complex Tools available:  mono and Xamarin  
Console apps Simple

 

Migrating Web Apps 

Migration for back-end and front-end applications in ASP.NET MVC is simple, and Microsoft provides a detailed guide. We can break it down into a systematic process like this:

1. Create a new .NET Core project.

2. Migrate/convert startup and initialization.

3. Migrate static content and bundle configurations.

4. Migrate views and actions.

However, for front-end apps that use web forms, migration isn’t currently feasible. Microsoft has no plans to port them to ASP.NET Core, perhaps because of the “System.Web” namespace contained in WebForms functionality. These apps will require a port instead of a migration; this blog provides details on that a port process might require.

Migrating Windows Apps 

For Universal platforms, no migration is necessary.

For Silverlight-based apps, migration requires only basic changes to namespaces. There is also a tool for this type of migration.

For WPF and WinForms desktop apps, migration is complicated. Currently, developers will have to use “mono” and “Xamarin” to make these apps cross-platform.

Migrating Console Apps

Migrations for this type of app is very straight forward, with certain limitations depending on host OS and application interactions. 

Apps with file handling are safe to migrate.

Migrating Other Types of Apps: Important Things to Consider

If your app isn’t a web, windows, or console app, there are important limitations to consider.

1. Missing 3rd party library support: .NET Core 2.0 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 has limitations, it will help bridge a lot of class libraries to .NET Core.

2. Missing .NET Framework features: Some .NET Framework functionality is still missing in .NET Core. For example, Entity Framework Core is not exactly the same as Entity Framework v6.

3. Access to Windows-specific APIs: If your app 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.

4. Partial support for VB.NET and F#: Microsoft and the community continue to work on providing full support, but it isn’t 100% yet.

As always, you should use the appropriate Microsoft-provided tools to analyze an app before you plan a migration.

 

When Should I Migrate? 

Another common question we hear is, “Is it too early or too late to migrate?” In my opinion, you should consider .NET Core migration today, or you should start any new project with .NET Core now. Microsoft has indicated that .NET Core is the future, and planning for that future now will be a great benefit.

 

How Can I Prepare Now for Migration at a Later Date? 

As mentioned before, .NET Core’s current state does not support all application types, nevertheless, the following are some approaches that can be followed for a more transparent and easier migration in the future. 

• Use MVVM/Model binding for web forms. This is more like the MVC way of doing things and can help lower the burden of migration in the future.

• Leverage APIs and client-side development. Apps built using more APIs and rich-client development such as Angular or React will have fewer dependencies on WebForms and will be easier to transition.

• Create .NET Standard Libraries. A .NET Standard Library can be used by both full framework and .NET Core, so you will know that code written inside of a library can work on both frameworks. This helps to move logic to re-usable components.

Even with the best planning, there is NOT an automatic way to get from WebForms to .NET Core. There WILL be breaking changes and things that must be re-written. This is an absolute at the current time. 

 

The future is here—make your plans now

.NET Core is the future for multi-platform apps. As we’ve seen, .NET Core offers great new native features not supported by the traditional framework. On the other hand, .NET Core does not fully support all existing app types for migration, especially those that are tightly integrated with Windows OS, and you must carefully consider and plan for these challenges. 

As a final word, please be aware that there is no perfect guide or migration scenario. Review your app functionality and know your apps before choosing the migration approach and platform that best suits the context of your existing applications.

 

¹ .NET Standard is a set of APIs that all .NET implementations must provide to conform to the standard. This unifies the .NET implementations and prevents future fragmentation. It replaces Portable Class Libraries (PCLs) as the tool for building .NET libraries capable of working everywhere.

²  .NET Framework can be used in containers as well, but container image sizes are larger for Windows OS.

 

 

Subscribe to our Blog

Previous Article
Apps in the Cloud: Deploying Your App Using Docker Containers and AWS
Apps in the Cloud: Deploying Your App Using Docker Containers and AWS

Welcome to the first post in a series of articles with one clear objective: to create a cloud-based framewo...

Next Flipbook
Photo & Go Case Study
Photo & Go Case Study

Gorilla Logic developed a custom e-commerce site to support Photo & Go’s omnichannel, “store within a store...

×

INTERESTED IN A CUSTOM AGILE TEAM?

First Name
Last Name
Company Name
Thank you!
Error - something went wrong!