Over the last couple of years there have been a couple of key developments in the .NET world. However, despite a lot of rhetoric from Microsoft about building a better developer ecosystem, the reality is that the current landscape for building apps using .NET is a mess and no amount of sugar coating is going to fix that. In this post I’m going to try to position a number of technologies in the hope that I can share where I think things are going.
If you’re thinking that I missed UWP out of the list of technologies in the title, you’d be 100% right. Microsoft hasn’t confirmed this (and in much the same way that Silverlight was never discontinued, I doubt anyone will say this) but UWP as it stands today is effectively end-of-life. I wouldn’t be expecting any major updates to UWP any time soon. I doubt it will get NetStandard 2.1 or .NET 5 support.
Let’s keep going and we’ll touch back on this point in order to discuss what the replacement is.
From the .NET homepage, it reads that .NET is “Free. Cross-platform. Open source. A developer platform for building all your apps.” Most of this is true but selling .NET 5 as a technology for building cross platform apps is a straight out lie, unless you include being able to run a command line utility on different operating systems. When we talk about cross platform apps we’re talking about building apps for iOS, Android, Windows etc and currently you cannot do this with .NET 5.
Ok, so why stretch the truth. Well, other than it being a good marketing angle, the reality is a bit more nuanced than simply “it’s not possible.” For example, you can use Xamarin.Forms to build apps for iOS and Android (and Windows at a stretch). Alternatively you could use the Uno Platform to build for Windows, iOS, Android, MacOS, Linux and Web. However, neither of these technologies are based on .NET 5. Both technologies are limited by the lack of .NET 5 support in Xamarin iOS, Xamarin Android and of course UWP.
If not .NET 5, then what’s in store for .NET 6? Well the good news is that there are tons of great changes coming that will make building cross platform apps using .NET much nicer. Microsoft has committed to combining iOS, Android and Windows into a single SDK style project format. They’ve also committed to align with .NET 6, making using of the new TFMs such as .NET6-ios and .NET6-android. This will also rebrand iOS and Android support to .NET for iOS and .NET for Android. These changes alone will have a significant impact on simplifying the development of cross platform apps (although it will need Visual Studio to pull finger and finally provide better tooling for multi-targeted projects).
.NET MAUI (aka Xamarin.Forms vNext)
Earlier this year the Xamarin.Forms team announced some grand plans to evolve the platform with some fundamental changes to how renderers and other plumbing works. This was also going to include adding tier one support for Windows and MacOS. This was going to be coupled with a name change to .NET MAUI to shake the industry perception that XF was just for building forms based applications. The team have documented most of these advances on the roadmap page.
Whilst it appears that progress is being made, the reality is that there is a long way to go to implement these changes. The roadmap started with an 18 month target but recently Microsoft has acknowledged that this has slipped and in fact will be delivered in a number of phases. Microsoft has committed to providing an update shortly, which should clarify the direction.
So, where does that leave Xamarin.Forms developers today? The good news is that the 5.0 release of Xamarin.Forms has a ton of fixes adding to the stability and performance of the platform. The team has committed to a migration path to .NET Maui, so there’s no reason for you not to start or continue building apps with Xamarin.Forms.
However, one thing to be aware of is that there is no .NET 5 support and that until the stars align with .NET 6, Xamarin developers (whether using Xamarin.Forms or not) are going to feel a little exposed as library developers start dropping support for .NET Standard in favour of supporting only .NET 5 (this has already been demonstrated by the EF Core team that have dropped NS2.0 in favour of NS2.1).
Windows UI (aka WinUI)
For those who have built UWP applications you may already be familiar with the Windows UI library of controls (aka WinUI 2.x). It would be easy to confuse WinUI 2.x with WinUI3 and assume that WinUI 3 is simply the next iteration of the controls. This is, in part, true – the controls for WinUI 2.x will be available in WinUI 3, along with a slew of new features. However, what sets WinUI 3 apart is that it is effectively an entire UI platform for building apps. Where in the past developers may have referred to themselves as a UWP developer, going forward developers will refer to themselves as Windows developers, which will translate to building apps using Windows UI.
Currently, there are two flavours of WinUI 3 that are hosted as a desktop app or a UWP app respectively. Initially you might think that the UWP flavour is the priority, considering that WinUI 2.x was a library of controls for UWP. This is not the case – see my earlier point about UWP being end of life. The reality is that WinUI for desktop is the way forward. WinUI for desktop is built on .NET 5 and will enable scenarios from WinForms and WPF, with an opt in model for capabilities taken from UWP like app container (see Project Reunion)
What’s the release timeline for WinUI? According to the roadmap and recent community call, WinUI is still on track for a 2021 release. I suspect that a bunch of features (including UWP and open source) will be dropped in order to make some artificial go-live date, most likely in first half of 2021 (this is pure speculation based on where the previews are at today and hints from the team in their monthly community calls!!!).
So far I’ve concluded that UWP is end of life and that WinUI is the future of Windows development but what about cross platform? Well this is where the Uno Platform kicks in – the platform today uses UWP as the definition for the cross platform APIs. In essence, the apps you build for Windows using UWP can be taken cross platform to iOS, Android, Web etc by leveraging Uno.
Since UWP is end of life, where does this leave Uno. Well they’ve been working along side the preview releases of WinUI to make available a WinUI compatible build of Uno. Going forward developers will build Windows apps, using WinUI, and will be able to take them cross platform using Uno.
Where does this leave Xamarin.Forms? The reality is that that the availability of WinUI and Uno doesn’t directly impact the trajectory of Xamarin.Forms. However, if you’re comparing technologies, it’s important to remember that at the core Xamarin.Forms and Uno take a vastly different approach. Xamarin.Forms builds on the look and feel of the native controls on each platform. Uno looks to have controls appear uniform across all platforms. Xamarin.Forms allows developers to control the look and feel by adjusting properties, and implementing renderers. Uno unlocks the power of XAML templates to allow developers to completely change the layout of controls without impacting their behaviour.
What is consistent across Xamarin.Forms and Uno is that both technologies are reliant on Xamarin iOS/Android being updated to support .NET 6. Going forward Uno (and potentially Xamarin.Forms if they adopt WinUI for desktop) won’t be limited by the constraints of UWP.
Currently the landscape for building cross platform apps using .NET can be quite confusing. Let’s simplify it:
- Today: If you’re working on a project today that needs to release in the coming 3-6 months, you should pick between Xamarin.Forms 5 or Uno
- Future: For projects in the 6-12 months timeframe, you can consider being an early adopter of WinUI (with Uno) and/or .NET Maui.