In 2000, Microsoft’s Professional Developers Conference was all about setting the scene for .NET, introducing many of the technologies we’ve used for the past two decades. Twenty years on, it’s fair to say that Microsoft has pressed a reset button on the sprawl of .NET and its many developer frameworks. At Build 2020, the company set out its roadmap for the next twenty years, building on its Project Reunion announcement.
The future is one .NET
It’s possible to look back six years or so to see the roots of today in the open sourcing of .NET and the creation of the .NET Foundation. The platform needed an independent body to shepherd it through the transition from the old .NET Framework to a new, legacy-free, modular .NET Core. That transition had to include more than Windows; it had to bring along Xamarin’s mobile clients and Unity’s 3-D gaming platforms, as well as aim to expand the reach of .NET to macOS and to Linux.
That brings us to 2020 and the upcoming switchover from the aging .NET Framework 4 to a new .NET 5, the next big release of .NET Core with most of the familiar .NET Framework APIs and namespaces. That transformation will see the start of big changes for Microsoft’s mobile and cross-platform Xamarin development tools, as Microsoft shifts engineering efforts away from Xamarin’s Mono to .NET 5.
Bringing Mono and .NET together in .NET 6
One thing is clear: Microsoft isn’t throwing away both its and your investments in Xamarin. Mono won’t be going anywhere yet. Plenty of big projects depend on Mono, and we’ll see Xamarin continue to evolve Mono to support new releases of Android and iOS. But if you want new features and new APIs and a wider cross-platform development model, then your future development strategy will be based on .NET 5 and the ongoing yearly .NET release schedule. A full, unified .NET is still some way off, and although .NET 5 will be a significant step forward, we won’t see unification until late 2021 and the planned release of the next long-term support release, .NET 6.
The intent isn’t to completely replace Mono, but to have one common set of class libraries and a single toolchain for .NET Core and for Mono, building on the work that’s already going on in platform-level features such as the .NET Standard libraries. That leaves an intriguing question: What does a cross-platform UI look like in the converged future? Although there’s a cross-platform option in the Uno Platform’s port of WinUI 3, with mobile device support alongside WebAssembly and macOS, the controls that Microsoft is shipping in WinUI are Windows desktop controls, and they work best in desktop and tablet applications.
Evolving a cross-platform UI framework for .NET
Xamarin offers an alternative to WinUI for cross-platform development. Its cross-platform strategy is based on a mix of XAML support for native controls for both iOS and Android alongside its own cross-platform Xamarin Forms. Xamarin Forms is an MVVM (model-view-viewmodel) development platform in its own right, with its own control look and feel based on Android’s Material Design language. Xamarin Forms gives iOS and Android apps a consistent look and feel while still giving them access to native features and services.
With .NET 6 intended to unify the various .NET platforms, Xamarin Forms is the logical foundation for a new set of mobile UI tooling and a new cross-platform UI framework for .NET. Microsoft unveiled this new approach at Build 2020, calling it the .NET Multiplatform App UI (MAUI).
.NET MAUI is the next generation of Xamarin Forms, intended to allow developers to build an app once in a single Visual Studio project with a single codebase, targeting any supported device. The aim is to deliver a simplified project structure. Rather than a single solution with separate projects for each platform you’re targeting, with MAUI a single project will contain the resources needed to target specific platforms. If you need native APIs for access to device-specific services, these can be bundled in a platforms view and used at compile time when targeting builds for each platform. Alongside the platform code, you can bundle resources that will be used by your XAML, including images and fonts, giving you one place to manage all the elements of your application.
The new project model that comes with .NET 6 is key to this approach, as it applies a more logical grouping to the modules used in cross-platform apps, and to how code is built and deployed. However, despite the structural changes to projects, the code you write tomorrow should be very like today’s, but easier to deploy across multiple platforms and to keep updated with changes to platform APIs and application design resources.
The road to .NET MAUI
We’re still months away from seeing usable .NET MAUI code, as it depends on .NET 6 SDK features, although a GitHub repository is already open with some of the initial implementations. When a preview does ship toward the end of 2020, what we’ll get should be fairly similar to the existing Xamarin Forms, which will continue being developed in parallel with .NET MAUI. Key changes will be around how you structure projects, with a new namespace moving from Xamarin’s own namespace to .NET’s System.
The published roadmap for .NET MAUI suggests that initially we’ll get a preview build based on a renaming of the current Xamarin Forms release, with some simplifications and new features coming from .NET 6’s new features. More changes will come during 2021 as .NET MAUI and .NET 6 evolve, with macOS and Windows controls joining Android and iOS by summer 2021. You should be able to deliver unified applications by the intended November 2021 release, with a release candidate due in September 2021.
Microsoft is planning other changes to Xamarin in the .NET 6 timeframe, moving other Xamarin libraries to System, and renaming Xamarin.iOS and Xamarin.Android to .NET for iOS and .NET for Android. It’s a logical move, if a little sad for those of us who’ve followed the development of Xamarin since the early days of Mono.
Perhaps a more positive way of thinking of it is that, with the move to a cross-platform .NET Core as the foundation of all things .NET, it’s not so much Microsoft absorbing Xamarin as Xamarin becoming the heart of .NET’s open source future. That’s a good legacy for the Mono project.