Special Offer: My C#/.NET Bootcamp Course is out now. Get 10% OFF using the code FRIENDS10.

In my last week’s post, I wrote an overview of different frameworks for .NET desktop applications. As soon as my article was published, Microsoft announced big news for Windows desktop developers.

With the recent Microsoft announcement of .NET 5 which will be released in Autumn 2020, Microsoft will unify the developer experience for all supported platforms.

Going forward, .NET 5 will support targeting Windows, Linux, macOS, iOS, Android, WebAssembly and more all with the same .NET 5 APIs.

.NET - A unified platform

.NET – A unified platform (Image: Microsoft)

This image grabbed from the announcement shows the unified .NET platform featuring desktop development, web development, cloud, mobile, gaming, Internet of Things, and Artificial Intelligence.

In this article, we’re going to focus on what implications this has for existing Windows desktop applications and what we as developers can do to prepare ourselves as well as our applications for the move to .NET 5 and why we should consider doing it in the first place.

What about .NET Core 3.0?

Microsoft has announced the release of .NET Core 3.0 for September 2019. .NET Core 3.0 allows us to migrate our existing desktop applications by adding WinForms and WPF support to .NET Core.

“.NET Framework 4.8 will be the last major version of .NET Framework.”
Scott Hunter, Director of Program Management .NET

On the other hand, he also mentions that:

“If you have existing .NET Framework applications that you are maintaining, there is no need to move these applications to .NET Core. We will continue to both service and support .NET Framework, which includes bug–, reliability– and security fixes.”
Scott Hunter, Director of Program Management .NET

So we do not need to migrate our applications, but if we do, we get to use all the benefits that come with .NET Core such as side-by-side deployment, new features, performance improvements, and cross-platform support.

In my opinion, migrating to .NET Core 3.0 is the first step in preparing an application for the new .NET 5 world. For any application that will be in production for more than just a few years and that is in active development I suggest migrating to reap the benefits of all the new .NET Core implementations.

Microsoft also offers us to further develop our WinForms applications after the migration to .NET Core 3.0. Because of the WinForms support we can develop our WinForms applications as long as we do not need newer platform features like the Microsoft Store, proper multi-monitor support or other features from the new Windows 10 APIs.

Before the announcement of .NET Core 3.0, the only option was to migrate WinForms applications to UWP applications if you wanted to run them on .NET Core and make use of new APIs. The release of .NET Core 3.0 gives us the option to stay on WinForms as a UI framework.

For applications that are no longer in active development, but more likely in maintenance mode, it is not required to migrate them to a newer version of .NET. Security patches will still be available for the (full) .NET Framework.

What are the benefits of .NET 5?

The announcement states three key improvements in .NET 5:

  • A single runtime and framework for all platforms
  • Take the best out of .NET Core, .NET Framework, Xamarin, and Mono
  • Provide everything in a single open-source code-base

In short: All projects should be based on the same project files, have the same APIs available to them, and benefit from the same performance improvements.

If you want to dive deeper into the announcement of .NET 5, make sure to check out the official Microsoft announcement.

In my opinion, .NET 5 brings developers closer together. Whereas Xamarin or UWP developers, as well as ASP.NET Core developers, enjoyed new tools, framework releases and APIs, WinForms and WPF desktop developers often felt left outside. .NET 5 will change that.

Today, you need to learn slightly different project file structures, different APIs, and different tools when dealing with different project types.

With the unification of all the targets and platforms, every developer will have the same tooling and the same APIs available to them. It’s a vast improvement.

.NET 5 closes the gap and allows for much simpler knowledge transfer between those targets and project types.

Again, for me, it’s a no brainer to migrate all existing applications that still are in development to .NET 5 when it’s been released in 2020.

XAML Island

XAML Island allows us to use UWP controls in Win32, WinForms and WPF applications. It also allows us to access UI related Windows 10 APIs from existing applications. Without XAML Island, those APIs were exclusively available to UWP applications.

XAML Island provides a way to modernize applications that cannot be rewritten as a whole but could benefit from access to controls based on Windows 10 APIs.

Thomas Claudius Huber has written an in-depth blog post about how to use a UWP control in an existing WPF application.

If you have newer applications and older applications it can be a viable use-case to migrate some controls within older applications to UWP controls instead of rewriting the entire application all at once.

It is worth mentioning that XAML Island 1.0 is released as part of Windows 10 version 1903. Any version prior will not support XAML Island.

Conclusion

Desktop developers often felt left out from all the shiny new things .NET Core had to offer. There were only a few new features for .NET Framework-based applications.

With the announcement of .NET Core 3.0 and its support for WinForms and WPF applications, Microsoft shows a migration path for existing Windows desktop applications which allows those applications to benefit from all the .NET Core improvements.

With XAML Island Microsoft offers another way of gradually modernizing existing .NET desktop applications by allowing them to use UWP controls.

In my opinion, there is a bright future for .NET and desktop development on .NET. With .NET Core 3.0 we get the chance to benefit from all the improvements of .NET Core. And with .NET 5 Windows desktop developers are finally on the same page with all other .NET (Core) developers.

 

Claudio Bernasconi

I'm an enthusiastic Software Engineer with a passion for teaching .NET development on YouTube, writing articles about my journey on my blog, and making people smile.