Aloha! Welcome to .NET MAUI

Aloha! Welcome to .NET MAUI! The all-new .NET Multi-platform App UI (MAUI). Announced at Microsoft Build 2020, Microsoft has evolved Xamarin.Forms and taken the next step in the .NET unification to give you a cross-platform mobile-first framework for Android, iOS, macOS, and Windows. .NET MAUI will introduce new ways to build applications. Available in .NET 6, in preview now!

.NET MAUI.NET MAUI (source: Microsoft)

What is .NET MAUI?

.NET Multi-platform App UI (MAUI) is the evolution of Xamarin.Forms extended from mobile to desktop scenarios with UI controls rebuilt from the ground up for performance and extensibility

Maddy Leger, Program Manager Xamarin/.NET MAUI Team “The Future of Native Apps Development in .NET 6

MAUI will help you deliver high-performance, cross-platform, native desktop and mobile apps from a single codebase. With .NET MAUI, you can build your apps for any device from a single codebase and project system, using one language, one set of libraries, and one UI stack for all.

What are Xamarin and Xamarin.Forms?

The most common descriptor for MAUI is the evolution of Xamarin.Forms, but what are Xamarin and Xamarin.Forms?

Xamarin is an open-source .NET platform for building iOS, Andriod, macOS, and Windows applications. Introduced in 2011, Xamarin allows you to share business logic across platforms using .NET while creating a native UI for each. Xamarin allows developers to share an average of 90% of their application across platforms).

.NET Mobile Apps with Xamarin.NET Mobile Apps with Xamarin (source: Microsoft)

To help with the overhead of creating native UI’s for each platform, we have Xamarin.Forms.

Xamarin.Forms is an open-source UI framework that allows you to combine the code for Xamarin.Android, Xamarin.iOS, Xamarin.Mac and Windows applications into a single shared codebase.

Xamarin Forms ArchitectureWhat is Xamarin.Forms (source: Microsoft)

Microsoft aims to create a unified .NET platform, replacing .NET Framework, .NET Core, and Xamarin. .NET MAUI is the next step in unifying .NET, replacing Xamarin.Forms. It addresses some of the issues and downsides of Xamarin.Forms while providing an updated architecture on top of the new generation of .NET and project system.

What about my Xamarin.Forms skills and applications?

Think of .NET MAUI as a new version of Xamarin.Forms. Microsoft has assured us that our Xamarin.Forms skills are transferable.

Xamarin.Forms developers will hit the ground running with new projects in .NET MAUI, using all the same controls and APIs they have grown to know and love. source

There will also be tools and guidance to help migrate applications. The team expect to have a version of the .NET Upgrade Assistant that can migrate Xamarin and Xamarin.Forms projects to .NET 6 and .NET MAUI in the July 2021 Preview 6 release.

What is different about MAUI?

If we already have Xamarin.Forms, what is so special about .NET MAUI? Microsoft is rebuilding the core of Xamarin.Forms, bringing us performance improvements, consistent design systems, and an extension from mobile to desktop.

Key Improvements in MAUI:

  • Single project experience across platforms
  • .NET Hot Reload
  • Modern App Patterns

Single Project Experience

.NET MAUI allows us to have a single project experience instead of one project for each target platform. A single project improves the developer experience by enabling developers to target and debug different devices without switching between projects or navigating the idiosyncrasies of each platform. We can use one language across our application to target all the supported platforms and easily share resources across while maintaining an option for platform-specific code.

.NET Hot Reload

Hot reload increases productivity for .NET developers, allowing instant updates to running applications with new code changes. Removing the build and deploy interruptions saves time and allows the development flow to continue. In .NET, they are expanding Hot Reload, bringing complete support to .NET MAUI along with other workloads.

Modern App Patterns

Model-View-ViewModel (MVVM) and XAML pattern, used in existing Xamarin.Forms applications, will continue to be supported and improved with the evolution. .NET MAUI will introduce further support for the Model-View-Update (MVU) development pattern, popular in C#, enabling developers to write fluent C# UI, creating a code-first development experience.

What’s new from Microsoft Build 2021?

During Microsoft Build 2021, Microsoft announced the availability of .NET MAUI Preview 4. Each preview provides us with more features and tools with general availability scheduled for November 2021 at .NET Conf.

With the release of Preview 4, you can now create functional applications across all supported platforms using .NET MAUI. In addition, they have added new capabilities to support running Blazor on desktop using .NET MAUI, allowing the reuse of Blazor UI components across native desktop and web applications.

Weather Twenty One .NET MAUI Preview 4Weather Twenty One .NET MAUI Preview 4 Demo (source: David Ortinau)

Alongside Preview 4 is the release of Visual Studio 2019 version 16.11 Preview. The Visual Studio 2019 16.11 Preview enables .NET Hot Reload for MAUI and provides productivity features for developing .NET MAUI projects. A project template option for a .NET MAUI application is now available in the 16.11 Preview, encompassing the new solution format with the multi-targeted project.

To see what is coming in future releases, visit the MAUI product roadmap.

How can you get started?

Before you get started, Microsoft has created a dotnet tool called maui-check that evaluates your system for development in .NET MAUI. The tool will scan for the required dependencies and try to fix any issues for you or suggest a way to fix them yourself.

Tool source: https://github.com/Redth/dotnet-maui-check

dotnet tool install -g Redth.Net.Maui.Check
maui-check

Once you have the complete .NET MAUI development environment setup, you can create your first app by running:

dotnet new maui -n AlohaMaui

Congratulations! You have a new .NET MAUI application.


Resources

Check out the resources below to find out more about .NET MAUI and the exciting future in the .NET ecosystem. Mahalo!


Melissa Houghton

Melissa Houghton is a Lead Software Engineer at Azenix and a Microsoft MVP in Developer Technologies.

Her work is focused on application development using Angular, .NET, and Azure, but she has a wide variety of skills and is always open to learning new things.

An advocate for women in tech with a passion for leadership, technology and giving back to the community. She frequents tech events, is an international conference speaker and organiser of DDD Melbourne conference, Melb․NET meetup, and Microsoft AU New Breakpoint Community.

Originally from California, Melissa loves to travel and now lives in Melbourne, Australia.