Guidance for Porting 'Complicated' Desktop Apps to .NET Core Published
After previously publishing developer guidance for porting "simple" desktop apps to the new .NET Core platform, Microsoft has just followed up with a two-part post on a more "complicated" project.
A couple weeks ago, Olia Gavrysh, program manager, .NET, explained the company's reasoning:
Since I've been working with the community on porting desktop applications from .NET Framework to .NET Core, I've noticed that there are two camps of folks: some want a very simple and short list of instructions to get their apps ported to .NET Core while others prefer a more principled approach with more background information. Instead of writing up a "Swiss Army knife"-document, we are going to publish two blog posts, one for each camp:
- This post is the simple case. It's focused on simple instructions and smaller applications and is the easiest way to move your app to .NET Core.
- We will publish another post for more complicated cases. This post will focus more on non-trivial applications, such WPF application with dependencies on WCF and third-party UI packages.
That more complicated project is now out, with the WCF functionality being of special interest to many Microsoft-centric developers.
As we detailed last month, WCF projects are a sticky point with .NET Core, the company's new cross-platform, open source direction for the venerable Windows-only .NET Framework that has been relegated to maintenance mode, with all new feature development being ploughed into Core offerings.
In announcing next year's shift to a unified .NET 5, Microsoft exec Rich Lander said, " If you are a remoting or WCF developer and want to build a new application on .NET Core, we would recommend either ASP.NET Core Web APIs or gRPC (Google RPC, which provides cross platform and cross programming language contract based RPCs)." That didn't sit well with several developers, one of whom said, "I don't understand the purposeful killing of WCF. It seems sadistic. They got us to buy in and make our apps rely on it, and now they're telling us we can't use it in the future, when our apps are already deeply tied to it."
So WCF dependencies on .NET Core require some extra work, and, reflecting the extra amount of detail required, Microsoft's Mike Rousos today (June 10) tackled the complicated project in a two-part post titled "Migrating a Sample WPF App to .NET Core 3" (part one here and part two here).
He cautioned that it wasn't a best-practices example, as he purposely threw in some anti-patterns to provide realistic, thorny problems developers might run into.
He said interesting dependencies in the app include:
- WCF communication with a backend trading service via a duplex NetTcp channel
- UI styling and dialogs from MahApps.Metro
- Dependency injection with Castle.Windsor (though, of course, many DI solutions -- including Microsoft.Extensions.DependencyInjection -- could be used in this scenario)
- App settings in app.config and the registry
- A variety of resources and resx files
"These posts don't focus on any one particular porting issue," Rousos said. "Instead, they're meant to give an overview of the steps needed to port a sample WPF app. If there are particular .NET Core migration topics you'd like a deeper look at, let us know in the comments."
These are the four major steps:
To help developers following along in the posts, the project is parked here on GitHub, and a five-part series of YouTube videos averaging about 20 minutes each are available for visual learners.
David Ramel is the editor of Visual Studio Magazine.