Still Thinking of Porting from .NET to .NET Core?
The Shift From .Net Framework to .Net Core
Established in the early 2000s, .Net framework was introduced as a choice of technology in many organizations and enterprises for developing customer-facing applications and back office applications. Soon after its launch, there was a lot of buzz about .NET being cross-platform. However, the technology could never mature for a full deployment on platforms other than Windows. Mono, Xamarin, Crossnet, Portable .NET were many such attempts developed for deploying .NET based applications for Linux or iOS platform. During 2016, .NET Core 1.0 – a free and open source managed computer software framework was released; it assured seamless deployment of full applications on Windows, Linux and macOS operating systems. However, organizations still face the biggest challenge of porting .NET applications that exist in the range of billions or trillion lines of code to .NET Core.
Prime Factors Behind .NET Core Porting
Undoubtedly, with multiple features in .NET Core over the .NET framework, organizations should weigh the benefits and risks before porting to .NET Core. For most organizations, operational and license costs form one of the contributing factors for porting existing .NET code to .NET Core. As you can clearly contemplate from Fig (1), Windows VMs cost 30%-50% more when compared with Linux VMs.
Fig (1). Calculated Cost
Cost-effectiveness, better ROI, increased performance, improved customer experience, easily maintainable, better-performing code and lower cost of ownership form the key reasons for porting from .NET framework to .NET Core.
Features of .NET Core
- Cross-platform: Runs on Windows, macOS and Linux operating systems.
- Consistent across architectures: Runs your code with the same behavior on multiple architectures, including x64, x86, and ARM.
- Command-line tools: Includes easy-to-use command-line tools that can be used for local development and in continuous-integration scenarios.
- Flexible deployment: Can be included in your app or installed side-by-side user or machine-wide. Can be used with Docker containers.
- Compatibility: .NET Core is compatible with .NET Framework, Xamarin and Mono, via .NET Standard.
- Open source: The .NET Core platform is open source, using MIT and Apache 2 licenses. .NET Core is a .NET Foundation project.
Challenges in Porting from .NET to .NET Core
Porting from .NET framework to .NET Core isn’t easy. The most common challenges organizations experience during porting include:
- OS Specific Code: Windows specific code will not run on other platforms
- Windows Communication Foundation (WCF): WCF-based services need to be upgraded to REST as WCF is not supported by .NET Core
- UI Component: Some class library has UI components and few operations are driven by UI events
- Third-party libraries: Some third-party components may not be compatible with .NET Core
- Unsupported code: OleDbCommand, Security (Identity Tokens) are some of the areas which do not have direct support
- API Pipeline: REST API pipeline works differently as compared to .NET Framework
Best Practices of .NET Core Porting
Xoriant addresses the challenges of .NET Core porting by understanding the unique business requirements. Our structured porting approach helps your organization to identify the risks at the early stages resulting in faster porting and better ROI. We have leveraged many tools recommended by Microsoft (Portability Analyzer, .NET API Analyzer, Project Conversion Tool) and created a few tools (Code flow analyzer) to analyze the code tree and code flows.
Fig (2). Structured Porting Roadmap
Let’s discuss the high-level activities involved in a .NET porting exercise
- Identify target libraries: You may not need all the libraries for your target application. If you are planning for API app porting, you will need to discard all UI components
- Start with most dependent libraries: Starting with most dependent library ensures that we eliminate the dependencies and can test those libraries the most
- Portability Analyzer: Calculate the percentage of portable code. This gives the rough estimate of efforts required for porting
- Third party libraries: If a .NET core equivalent is available, use the same or plan for rewrite based on the desired functionality. In some cases, legacy libraries may not be needed such as PDF generator for the report
- Build the code: Convert the project to .NET core 2.0 and check for the errors during the build
- NuGet Packages: Use reverse package search and windows compatibility pack to get the relevant NuGet packages. Most of the .NET Core libraries are available via NuGet packages
- Incompatible coded – There will be some code which will be incompatible. Identify that and modify/rewrite the code
- Platform-specific code: In case the application is targeted for both Windows and Linux platforms, ensure that the platform-specific code is handled accordingly
- Unsupported features: Identify the code which will not work (Remoting, WCF, Windows forms etc.) and plan for a rewrite
- Build, Deploy and Test: Once porting is done, build and deploy the code. Perform the testing on both Windows and Linux servers
Xoriant’s expertise spans across a wide range of use cases – from straightforward framework change to complex integrations. Moreover, Xoriant has also assisted organizations to define a roadmap which needed a combination of porting and migration. For example, a few clients with large monolithic applications where porting UI to .NET Core was complex. In this case, UI needed to be rewritten using one of the UI frameworks (Angular or React) whereas the back-end code needed porting to .NET Core with a wrapper of .NET Core Web APIs. The ROI of .NET Core porting depends on the size of the application and the deployment scale.
Benefits of .NET Core Porting
Using Xoriant’s structured approach in .NET Core porting, organizations can expect up to 30% increase in performance along with an increased ROI. The other benefits include translating to improved customer experiences, more maintainable and better-performing code and lesser cost of ownership. For an organization running 1000 Windows VMs can save up to $200K monthly if they choose to switch to Linux VMs.
To know more about a seamless .NET Core porting experience or about our structured porting approach, write to us at email@example.com.