Although Build 2020 was a online virtual event, it was a fun and full of great announcement, one of which is Project Reunion. Combined with the first preview of WinUI 3, it became the biggest tech story of the day. As a .NET developer, this is a very good news because it unifies all project types into .NET 5 and modernized the desktop app development story.
A Little History
Windows app development has always been split. We have old tech like WinForm that a lot of old productivity apps are built on. There’s also WPF that is a bit more modern that focuses on content based apps using XAML and DX9 for rendering. Then it comes the Windows 8/10 era where people are more familiar with smooth touch interface from their smart phones, so Microsoft invented the state of the art UWP framework. UWP is everything a mobile app developer expects. It has sandboxes environment, DX12 powered composition layer for fast and smooth UI interaction, controlled system permission that ask user for access, and last but not least, it can be compiled to run natively on a range of device types including Windows 10 family, Xbox , Hololens and Windows IoT. The advanced UI framework, which only now had the name WinUI, was exclusive to UWP. However the sandbox nature is not suitable to every desktop app. Most Windows developer did not buy into the UWP effort, and since WPF is old and none cross platform, a lot of devs have chosen to go with web frameworks like Electron.
What Is Project Reunion
Project Reunions, in theory, should bring traditional win32 and UWP together and unify all Windows app type to be just Windows App. The road map is not yet clear as the team is still exploring what is the right path, but we do get a sneak peek today.
WinUI 3 preview 1 and .NET 5 preview 4 together powers what’s called a .NET 5 desktop app with WinUI 3. It’s neither WPF nor UWP, but it uses WinUI 3 with XAML like how UWP does it. It’s a desktop win32 app framework. It runs on .NET 5, and the UI is powered by WinUI 3. It’s the best of both worlds. You get the performance and level of access of win32 and the smooth UI from UWP. This is what Windows developers needed all along, and although too many years late, Microsoft has finally gave in.
So, What Should I Use?
No, UWP is not going away, so there is still the question of what you should use for you next project. Although the effort is called Project Reunion, so far, they have not really been reunited. UWP runs natively, so it uses .NET Native, which is not .NET Framework or .NET 5 (or Core if it’s before 5). .Net 5 brings C# 9 support, but since .NET Native is still on .NET Standard 2.0 instead of 2.1+, it only has part of C# 8’s support. What this also means is that since .NET 5 desktop apps are win32, they can only run on desktops. They will not run on Xbox or Hololens. They will run on Windows 10X, but only in a container like how a normal win32 would. Another issue is that if you are developing a full stack app all in the .NET stack with a single solution file. If you intend to use ASP.NET 5 on the backend and Blazor with .NET 5 on the web, you probably don’t want to choose UWP as you native app platform as a .NET Native project cannot share too much code with a .NET 5 project. This would’ve been fine if you only target desktop platforms, but if you need you app to run on Xbox or Hololens, you are out of luck.
So, again, which one should I use? Well, Microsoft does not have a plan to bring UWP to .NET 5, yet. However, never say never. They did claim that it is on the roadmap as the whole point of reunion is to left no one behind when modernizing .NET. If WPF and WinForm apps can move forward with .NET 5, UWP certainly can with a future version of .NET. So if you need to build a new app right now, and you don’t need system access (if your app can’t run in sandbox, obviously go with win32 .NET 5 desktop app with WinUI 3), go with UWP. It gives your app the ability to target multiple device types, and UWP is more friendly with power consumption as it has life cycle methods that suspend the app when it’s appropriate. At some time in the future (most likely next November with .NET 6 as they heavily implied), your UWP app will have a natural way to move to the latest .NET.
Project Reunion is definitely exciting, but it’s really early to tell and it’s going to take even more time for the apps to start take advantage of the new framework. If you are a dev and are interested, check out how to get started with the first preview of WinUI 3.
Like my content? Buy me a coffee.
I regularly post blogs about tech and programming.