It might be painful but the long-term gains of migrating to .Net 5 are worth the disruption, Microsoft says.
Microsoft’s journey with the .Net framework has run more than 20 years. When it launched, .Net was oriented around monolithic client/server applications in tightly defined IT environments. Those days are long since over as we have moved to the loosely-coupled cloud, microservices, and mobile applications.
Microsoft kept up with the times and has evolved .Net for the brave new world of the cloud. So if you have some existing .Net applications in-house, you’ll have your work cut out for you migrating to the new framework, but Microsoft and MVP consultants say it will be worth it.
All told, Microsoft had three frameworks: .Net Framework, the original; .Net Core, introduced in 2014 as the successor to Framework adding support for Linux and Mac; and Xamarin, a port of sorts of the .Net Framework to Android phones, which Microsoft acquired in 2016.
[ Skills and training: 29 top cloud certifications ]
Last year Microsoft announced it would combine .Net Framework, .Net Core, and Xamarin with a single unified platform called .Net 5 Framework, which was released in November. Microsoft encourages starting all new projects in .Net 5 and migrating any existing code from older framework.
The latter step isn’t trivial but with a little guidance can be done. Our sister publication InfoWorld has done numerous and excellent deep dives into the technical aspects of .Net 5, so we will stick to the higher level, strategic aspect of the new framework and why it is worth the headache of disrupting your existing .Net infrastructure.
Introducing .Net 5
Before diving into the why, let’s look at the what of .Net 5. The final version of .Net Framework was 4.8 while .Net Core was 3.1. To avoid version confusion, Microsoft skipped ahead to version 5 for the unified platform. You will often hear it referred to as “One .Net.”
Some of the key features of .Net 5 include:
- Cross-platform implementation
- Support for all key platform features for .Net core, .Net Framework and Xamarin
- Open source & community-oriented
- Support with future updates to Visual Studio Code, Visual Studio 2019, Command Line Interface and Visual Studio for Mac.
- Support for platform-specific features like Windows Forms, & WPF on Windows
- Side-by-side installation
- Smarter deployment & packages
- Small project files
In addition to endpoint support, .Net 5 has Azure app development with a mix of tools and frameworks, including Web API, ASP.Net, serverless computing, Azure databases, Docker containers, microservices, DevOps and more.
“Dotnet Five is an extremely interesting new technology and an extremely interesting part of the journey going forward in this vision that Microsoft often refers to as One Dotnet,” said Markus Egger, president and chief software architect of EPS Software and a Microsoft MVP.
“And One Dotnet really gives you a unified platform. So when you think of how .Net has evolved, since it was first introduced over 20 years ago, it ended up being reimagined and ended up being split into different incarnations, different runtimes runs on different platforms,” Egger added.
Steve Smith, an architect and .Net trainer who runs a .Net development house called Ardalis, says you have the option of doing nothing with your app and it will work just fine for the foreseeable future. “You don’t have to migrate because there’s no one pulling the rug out from under your apps. But there are a lot of compelling reasons by why you might want to migrate. And whether or not the rewards outweigh the cost or the risks of doing so will depend a lot on the type of apps that you’re running,” he says.
What was left behind
While much technology was advanced in .Net 5, some things were left behind, according to Scott Hunter, the director of program management for .Net at Microsoft. The Windows Communication Foundation (WCF), and ASP.NET webforms were not brought over, although there is a replacement technology for ASP.Net called Blazor for building Web applications in C#.
“Those are those are examples where I would tell a customer, if you have a big ASP.Net webforms application or a big WTC-based application, maybe you just leave that where it is because of the effort to port it,” says Hunter.
He emphasized that WCF is not being removed and apps that use it won’t break, the library just won’t be advanced any more. It has been made available on GitHub as an open source project, which Hunter detailed here.
To migrate or not to migrate
Egger said he tells clients not to panic or get overly excited by the changes to the system. “Some of this stuff may just not have to be moved at this point. So I think the biggest mistake people make is to think that this is another one of those instances where they have to throw it all overboard and make a huge investment again, which is not the case. I think this can be much more gradual,” he said.
Smith also feels the changes to .Net 5 are not that radical and most of the basic features haven’t really changed. “If you’re building business applications in ASP.NET, or ASP.NET Core, and you’re familiar with the predominant pattern for doing that, which is MVC (Model View Controller), it’s going to be like 95%, compatible between what it looks like now, so your day-to-day work of working with controllers and views and actions or API endpoints is very similar, and it will feel very comfortable to you,” he said.
“I tell most of my customers, if you have an app that’s working great today, and you’re happy with it, don’t rewrite it,” said Hunter. “You know, rewriting an application is expensive. But I will throw some caveats; what we would tell most of our customers, if you’re going to build a brand new application, build the new application on the new tech.”
His number one reason for supporting .Net 5 is performance. When porting old apps to the new framework, most of them get a 25% to 30% improvement in performance, and in some cases are up to 50% faster just with a recompile.
Other reasons to migrate
Another reason that a company might want to move into the new framework is that .Net is patched every month as part of Patch Tuesday, which means fixes but also changes. That means your application might break even though you didn’t change anything. That won’t happen under .Net 5.
One of the key tenants of .Net 5 was what Microsoft calls side by side. .Net 5 is part of Windows dotnet framework but starting with the new version it is not part of the patching system, so that means you have the control of when things are updated, versus an automatic update you could not prevent every Patch Tuesday.
Microsoft is very good about migration support. If you want to migrate from, say, SQL Server 2012 to 2019, the new database comes with wizards to migrate almost everything from the old database quick and easy.
.Net 5 is no exception and comes with a couple of migration tools. First is called the Portability Analyzer, which you run on your existing application and it tells you if the APIs the application uses are supported by .Net 5 or it’s an API that doesn’t work on cross platform operating systems.
Another product is called Try Convert, which converts the project file, that’s the description of your app, to see if it will work on .Net 5. It converts that for you. Microsoft is also working to release a new tool that combines all of its smaller tools together into a single experience. It’ll be an app that you can run against your existing .Net framework application and it will convert the application project file and will fix the references to libraries as well as common things in source code that Microsoft knows it can fix.
Last bits of advice
Egger advises IT shops to go slow with the migration to the new framework and take it step by step. “You’ll probably find that you have a smoother path forward into the new technology. And then you can take in more piece by piece. So we do a lot of projects, where you know, we’re replacing some of the back end services or replacing some of front end webpages with a combination of things. But we didn’t have to replace the whole other thing. So yeah, go slow in that sense. Don’t freak out,” he said.
Smith said one of the things that will be easiest to move forward will be if enterprises move their class libraries to .Net standard libraries, because those can be consumed by the .Net Core. From there, it’s relatively straightforward to migrate those forward to .Net 5.
“It’s generally a good idea to try and do this in a set of phases, as opposed to a big bang all at once upgrade for any sizable app. And so you try and look for places where you can kind of stop along way and still have a working running app,” he said.
Microsoft is not sitting still, planning for .Net 6 in November of this year. An early preview just became available. .Net 6 will feature a fully unified cross-platform experience with Xamarin fully supported so one app will work on Windows, Linux, MacOS, and Android. Blazor support will be extended and .Net will support Arm64 and Apple silicon.