.NET 6 comes to Ubuntu – but where is MAUI for Linux?

Microsoft and Canonical have integrated .NET 6, the latest version of cross-platform .NET and also a long-term support (LTS) release, with Ubuntu 22.04 (Jammy), also an LTS version. It was already possible to run .NET 6 on Ubuntu, but there are two key changes in Program Manager Richard Lander’s post.

.NET in a Chiselled Ubuntu container

The first is that several .NET packages are now built by Canonical, supported by Canonical, and installable via a simple apt install command. Options include the full .NET SDK, or just the ASP.NET Core runtime, or just the .NET runtime. This is now Microsoft’s recommendation for .NET on Ubuntu, though developers waning the very latest builds should stick with the Microsoft packages.

The second, and the more interesting part of the news from a developer perspective, is the introduction of optimized .NET on Ubuntu containers, called Chiseled Ubuntu Containers. The idea is that if all that is required is a minimal container for running an ASP.NET Core application, this will exactly fit the purpose, and will be both smaller and more secure than a generic Ubuntu container.

According to Lander, “these images are 100MB smaller than the Ubuntu images we’ve offered until now and don’t include a root user.”

By default, these images have no shell and no root user. “That means it is not possible to exercise capabilities and operations that require root,” said Lander.

All of this is welcome, but there is one obvious gap in the work Microsoft and Canonical are doing for .NET on Ubuntu, which is the lack of any official solution for a cross-platform desktop application that works on Linux. The recently launched .NET MAUI (Multi-platform App UI) works on Windows, Mac, iOS and Android, but not Linux.

“Still waiting when MAUI/Xamarin.Forms will work with Linux,” said one dev in response to Lander’s post. “Understood. I’ll make sure the MAUI folks see this,” said Lander, a diplomatic reply but no indication of progress. Others chimed with similar requests.

Does it matter? Only a small minority of desktops run Linux, but there are plenty of developers among those who do, making it somewhat strategic. There is a mismatch between Windows, dominant on the desktop, and web development, which is largely Linux-based. Microsoft has done remarkable work with the Windows Subsystem for Linux but Linux is increasingly attractive as a developer desktop for this reason. Another interesting platform is Google’s Chrome OS, which can run Linux desktop applications.

Part of the problem is that Microsoft’s strategy for desktop applications (even on Windows) has been confused and inconsistent, with huge effort directed towards UWP (Universal Windows Platform) which never gained momentum.

Now there is MAUI, but in answer to the question about Linux support Microsoft Program Manager Immo Landwerth said last year that: “When we invest in Linux, we tend to do it on the server because that’s where most of the Linux momentum seems to be. You might say “no, you’re doing this because of Azure”, but it’s the other way around: Linux is super relevant for Azure because Linux is super relevant for the server and cloud.”

There are of course unofficial solutions to this issue. One is Avaloniaת which is loosely a version of Windows Presentation Foundation that works cross-platform and is set to gain support for iOS, Android, and in-browser via WASM. There are also forks of MAUI that add Linux support.

Perhaps most interesting though are the prospects for Blazor, a hybrid technology which runs in the browser via WebAssembly as well as within MAUI. It is already possible to create a desktop application using Blazor and Electron, where Electron is the toolkit also used by Microsoft’s Visual Studio Code.

Microsoft’s Steve Sanderson, inventor of Blazor, asked in 2019: “Would you be happy to use Blazor with Electron, or do you feel it’s necessary to have something more bare-metal?” Perhaps, if Microsoft can bring itself to invest in the idea, Blazor with or without MAUI may be the solution.