Microsoft’s MAUI cross-platform framework: Tooling still in preview and gaps remain

Microsoft’s .NET Multi-platform App UI (MAUI) has hit general availability, a milestone in the software company’s efforts to provide a cross-platform framework for desktop and mobile applications built with C#.

MAIU is now generally available – but the tooling is still preview

MAUI – announced at the Build developer conference, which is currently underway – is an evolution of Xamarin Forms, the framework acquired with Xamarin that enables a GUI to be defined in XAML (though different from the XAML used by Windows Presentation Foundation) and rendered using native controls on iOS and Android.

Xamarin Forms had some support for desktop platforms, but with MAUI Windows and Mac are included from the start, along with Samsung’s Tizen. Xamarin’s cross-platform approach was always to use native controls, and MAUI continues that, making it distinctive from alternatives like Google’s popular Flutter, though there is also support for drawn controls and an alternative control library which is currently experimental.

Microsoft has struggled to deliver MAUI, which was originally planned to arrive with .NET 6.0 and Visual Studio 2022 in November last year. Here it is though and the question developers are asking is whether it now provides the cross-platform GUI that the company’s .NET Core initiative has hitherto lacked, and a strong route to using the same language and runtime across web, mobile and desktop.

MAUI is an advance on Xamarin Forms, not only with broader platform support, but with architectural changes and modernization. Xamarin Forms required multiple projects, one for each platform, but .NET MAUI can use a single project for multiple platforms. It includes a new abstraction for rendering controls based on handlers, rather than renderers as in Xamarin Forms, giving MAUI a decoupled UI layer that is more flexible. C# 10 and .NET 6 means modern language features are available. Performance is improved thanks to .NET 6 along with AOT (ahead of time) compilation.

There is also a new control called BlazorWebView that allows Blazor applications – which are web user interfaces written with .NET – to run in .NET MAUI desktop and mobile applications.

In this scenario the .NET code runs on the device, not in WebAssembly as in Blazor browser applications. Blazor hybrid applications are Microsoft’s solution for adding a web target to MAUI.

The general availability of MAUI is a significant landmark but there are snags. One is that the tooling is not yet done. On both Windows and Mac, developers need the preview of Visual Studio 2022 17.3, not the current version.

“Visual Studio 2022 will GA .NET MAUI tooling support later this year,” said principal product manager David Ortinau.

We found limitations even with the preview tooling. On the Mac for example, the latest preview Visual Studio was unable to load a MAUI project without the Android SDK installed, even if an Android target is not required. Visual Studio Code and/or the .NET command line had no problem compiling and running the project for macOS and iOS.

Some developers have reservations that will be harder to fix. Why does MAUI not target Linux and web? web is there to some extent via Blazor, but that does not accommodate non-Blazor developers as this coder observes, saying that there is no solution for those who want to bring their existing XAML and Xamarin Forms skills to the web.

Another common observation is that Microsoft itself appears not to use either Xamarin Forms or MAUI for first-party applications, preferring alternatives such as Electron, used for Teams and Visual Studio Code.