Let’s say you have a great web application – it runs fine in the browser, but for some reason the customer wants an app that’s native to mobile or desktop.
Enter .NET MAUI, which stands for .NET Multiplatform App UI. It’s a cross-platform framework for building native mobile and desktop apps using C# and XAML.
Microsoft calls it the “next evolution of Microsoft’s Xamarin”. It shares much in common with Flutter, Google’s cross-platform, open-source UI software development kit that supports applications for Android, iOS, Linux, macOS, Windows, Google Fuchsia, and the web from a single codebase.
Microsoft states that .NET MAUI is intended for developers who want:
- Write cross-platform apps in XAML and C# from a single shared code base in Visual Studio.
- Share UI layout and design across platforms.
- Share code, tests and business logic across platforms.
However, what is not mentioned is that .NET MAUI will allow frontend and web developers to turn their web apps into a near-metal mobile or desktop app that can run on Windows or Mac, explained Sam Basu , a senior developer attorney at Progress Software and host of the .NET Dev Show on Twitch. Linux is not yet supported by the .NET MAUI.
Progress has worked with .NET MAUI and Microsoft from “day zero,” Basu said, and has used .NET MAUI to build apps in the iOS and Android app stores. What Progress offers with .NET MAUI is a polished performance UI, so developers don’t have to hard-code the entire UI. His Telerik DevCraft includes libraries and tools for .NET MAUI.
“If your customers want to see the same experience on desktop or mobile, then this is an easy way out; and also for developers not to reinvent the wheel and come up with a whole new user interface and experience,” Basu told TNS at Progress Software’s Progress 360 developer conference last week.
A native app has a native UI, native performance to ensure speed, and native access to all device APIs, he said. For Apple products, being native means the app is in Swift or Objective C; for Android it means Java or Kotlin. On Windows, of course, that means .NET, he explained.
“It’s difficult for companies because now they have to maintain three different code bases for a single app,” he said. “So today, ideally, we’re looking for cross-platform solutions where I can have a single thing running anywhere.”
In addition to converting apps for Windows, .NET MAUI leverages Mac Catalyst for the ability to convert apps to iOS.
While there are already single-page frameworks for converting web apps into mobile apps, these options don’t allow developers to tap into some of the native features of a mobile platform – like the camera or the accelerometer on your phone. Also, single-page framework apps aren’t always allowed in app stores, he added, which can limit the apps’ exposure.
“They’re not in the application stores and they don’t have access to all of the devices, things like camera, geolocation, accelerometer, all of our device APIs,” he said. “That’s something you get from .NET MAUI, pretty much free.”
“The runtime is really tailored to the application and the specific things of .NET it uses, so it just gives you what you need. So that’s how they keep it small,” Basu said.
“Electron gives you full access to things on the desktop that you might not need. An electron on mobile doesn’t work really well because it’s a big app pack. Electron is primarily for the desktop,” he said.
With .NET MAUI, the conversion doesn’t leave the app dependent on Node.js, allowing it to create a more native experience in a smaller footprint.
“We can simply rely on .NET to bootstrap our app,” explains Basu. “Because we don’t support the browser component, because we don’t support the runtime, it’s just a little lighter and loads faster. As long as you have a browser on your device via mobile or desktop you should be good.”
How .NET MAUI differs from alternatives
Other options include using React Native and NativeScript, he added.
“These are platforms that allow developers to write web things and then eventually turn around and write a native mobile app,” he said. “It’s much, much easier for .NET developers.”
It also differs from Flutter in a few ways, as explained by Vince Giacoppo, technical project lead at developer recruitment agency Protovate. Giacoppo noted that .NET MAUI doesn’t support web, but “developers can use the Blazor framework to provide a bridge to using MAUI resources. “
It’s still early for .NET MAUI, Basu warned.
“We have companies and businesses that are taking it and looking at this as a way to write their next cross-platform app,” he said.
Disclosure: Progress Software paid Loraine Lawson to attend his Boston conference.