Xamarin Forms turns to .NET MAUI – single project and code-base dev experience

Yesterday Microsoft announced .NET Multi-platform App UI (MAUI) – the effort to turn Xamarin Forms apps use single cross-platform code-base targeting multiple platforms. Demos from Build conference yesterday gave clear signal – it’s not just an experiment but real deal. They really had single project running on Windows desktop and iPhone. This blog post is short overview of what’s coming.

.NET MAUI

Today Xamarin applications need separate project for each target platform. .NET 5 – coming this autumn – lays excellent base for multi-targeting as .NET Core, Mono and Xamarin will all base on same base class library (BCL) and SDK toolchain. Besides desktop and mobile, .NET MAUI will support also new foldable devices like Microsoft Neo. First previews of .NET MAUI will be available later this year when Microsoft focuses to .NET 6 that is scheduled to release with .NET MAUI at November 2021.

Developing .NET MAUI applications

.NET MAUI project in Visual StudioImage of .NET MAUI solution here shows how there is one project targeting multiple platforms. There will be new Platforms folder in .NET MAUI projects and under this we can see separate subfolder for each target platform. Screenshot here shows BluetoothAdapter class that is platform dependent. There will also be support for platform specific resources.

Supported platforms will be defined in project file using .NET 5 monikers like net5.0-ios, net5.0 and net5.0-android.

As .NET MAUI is advancement of Xamarin Forms then application pages use good old XAML and C#. Besides code-behind, modern patterns like Model-View-ViewModel (MVVM) and Model-View-Update (MVU) are supported too. MVU is new UI pattern enabling developers to write fluent C# UI-s on .NET MAUI.

Transition to .NET MAUI should be almost painless as .NET MAUI comes with controls and API-s already present in Xamarin Forms.

Second front: Blazor WebAssembly

Yesterday Microsoft also launched Blazor WebAssembly to general availability. At January during .NET Conf: Focus on Blazor online conference Microsoft demonstrated some very interesting experiments with Blazor:

Electron and WebWindow are able to take Blazor applications across platforms and devices. Mobile bindings enable use of native API-s to Blazor WebAssembly applications. Although Blazor tooling targets web applications, these experiments show clearly that Blazor is able to jump out from its box.

Blazor in WebView

What makes Blazor front interesting is the fact that it may give us different tooling for multi-platform applications. .NET MAUI will be for native multi-platform applications and some Blazor multi-plaform offering will be for applications built using web technologies.

As there’s time a little bit over year to launch of .NET MAUI it will be interesting to see where Blazor evolves and if there will be some connection point for these two multi-platform worlds.

.NET MAUI roadmap

The current roadmap spans from this to next autumn.

  • Late 2020 – Preview 1
  • Early 2021 – Preview 2 and Preview 3
  • Mid 2021 – Preview 4 and Preview 5
  • September 2021 – Release Candidate
  • November 2021 – General Availability

References

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    One thought on “Xamarin Forms turns to .NET MAUI – single project and code-base dev experience

    Leave a Reply

    Your email address will not be published. Required fields are marked *