Microsoft has released an updated version of .NET MAUI (Multi-platform App UI). Also called “dotnet/MAUI,” “MAUI net,” or “MAUI dotnet.” Previously released in 2022 with .NET6, NET MAUI is revolutionising cross-platform application development as part of the larger .NET 8 - learn more about .NET 8 here - ecosystem, allowing developers to build stunning apps in less time using one single codebase.
In the not-so-distant past, cross-platform app development inevitably meant dealing with multiple technologies and frameworks to create apps that could work on various platforms seamlessly. This resulted in several issues, including code duplication, reduced developer productivity, and increased code complexity—not to mention the costs involved.
With the .NET MAUI framework, developers now have access to a unified framework to write application logic one time and have it deployed across the web, Windows, iOS, Android, and MacOS. .NET MAUI is changing the way developers create desktop, mobile, and web applications. This blog is a comprehensive overview of what .NET MAUI is, how it works, and how it fits into the broader .NET framework. Let’s begin.
.NET MAUI is the newest iteration of the open-source framework Xamarin.Forms, which was also widely used for cross-platform app development. .NET MAUI builds on Xamarin’s strengths while adding new, more useful features relevant to modern cross-platform app development. The result is an improved and updated platform with better performance and expanded capabilities.
.NET MAUI can create native desktop and mobile applications with XAML and C#. Like Xamarin, it is also open-source, with MAUI UI controls improved to provide better performance and scalability.
While MAUI development is praised for its cross-platform capabilities, it’s important to note that you can still add platform-specific code and resources as needed. With .NET MAUI, you can create applications for iOS, Android, macOS, and Windows. Whether you choose to do so from a single codebase or by creating specific code per platform is up to you.
However, the key goal of the MAUI UI framework is, of course, to enable developers to implement the majority of their UI layout and app logic from one single codebase. In a nutshell, therefore, with .NET MAUI, you can:
With the much-anticipated release of .NET 8, .NET MAUI is a powerful addition, especially for those looking to leverage the .NET framework’s cross-platform capabilities. .NET MAUI in .NET 8 enhances the framework’s overall performance, stability, and developer experience through performance improvements and platform-specific fixes.
.NET MAUI boasts an increased battery of manual and automated testing, as well as a narrowed focus on regressions. Performance enhancements have also been made to “Setter Specificity” performance and ActivityExtensions.GetWindowFrame on Android to improve overall app performance.
Additionally, performance optimisations such as improved rendering speed, faster startup times, and an overall smoother user experience have also been made in .NET MAUI.
To improve end-user app UI and make them more visually consistent and accurate, updates and fixes were also made on several UI elements and controls, such as:
Improvements have also been made to the MAUI platform to ensure a better and more consistent developer experience. These include the drag-and-drop functionality, the appearance of the tab bar, and several platform behaviours for a more streamlined workflow.
Microsoft has also improved .NET MAUI’s reliability and stability based on reported stability issues with Xamarin.Forms, so the new UI is more reliable and stable, ideal for handling cross-platform development requirements.
.NET MAUI’s framework is equipped with more accessibility features that allow developers to create more inclusive applications that can cater to users with special accessibility needs.
.NET MAUI also comes with improved tooling support for better productivity and more streamlined workflows. These include more intuitive debugging capabilities, smoother development tooling integration, and improved IntelliSense.
Microsoft has also extensively documented and compiled guides and learning resources to help developers learn .NET MAUI quickly, including migrating existing projects and files to .NET MAUI, best practices for cross-platform app development, and documentation for onboarding and troubleshooting.
Before .NET MAUI, there was Xamarin.Forms, a User Interface toolkit that allowed for creating UIs for iOS, Windows, and Android using a unified codebase. It already facilitated cross-platform app development through a shared UI abstraction layer.
Arguably, both Xamarin.Forms and .NET MAUI provide developers with a platform to build cross-platform applications, but .NET MAUI takes Xamarin’s capabilities further with its new key features. .NET MAUI is described as the “evolution” or next step of Xamarin, with extended support for additional platforms and an even more powerful unified development experience.
In terms of architecture, Xamarin.Forms used a page-centric architecture that allowed developers to create pages and then combine these pages to build the UI. Xamarin also relied on platform renderers for rendering the UI components on each platform.
With .NET MAUI, a new architecture applying the Model-View-Update (MVU) pattern is used, and its goal is to simplify UI development. Through the MVU pattern, developers can define an app’s state and logic using a single code file without needing to create multiple pages that require rendering. This allows for a more reactive and unified UI development approach.
Performance-wise, Xamarin allowed for native-level access to application programming interfaces on a platform-specific level. However, the downside is those apps usually experienced slower startup times since they had to initialise the Xamarin.Forms framework each time.
With .NET MAUI, Microsoft emphasises improving overall performance and startup times via several performance optimizations and significant framework overhead reduction. Ahead-of-time (AOT) and single-project compilation are also new features of .NET MAUI to improve app performance further.
In terms of supported platforms, Xamarin offered support for app creation across iOS, Android and Windows using a single codebase. .NET MAUI further expands this by supporting MacOS and Tizen, allowing for an even more comprehensive cross-platform development experience.
Regarding ecosystem and development tools, Xamarin was already ahead of the game with an established ecosystem and comprehensive development tools. Integrations with development environments like Visual Studio also enhanced the selection of libraries and plugins for developers to access.
.NET MAUI leverages this comprehensive ecosystem and tooling. It further fine-tunes tooling integrations and streamlines the overall development experience. .NET MAUI is also more productivity and collaboration-focused with features like code-sharing across various .NET platforms.
Projects currently on Xamarin.Forms can easily be migrated to .NET MAUI thanks to Microsoft’s migration tools. While there will still be a degree of updating involved, such as adapting to new APIs and patterns and updating the codebase — .NET MAUI was generally designed to be backwards-compatible.
This means the two programs will have a smooth upgrade path between them, from Xamarin to MAUI, to encourage developers to leverage new capabilities and enhancements without needing to redo entire projects in .NET MAUI.
Some of the features and controls in .NET MAUI that make it easier and better to upgrade from Xamarin are as follows:
.NET MAUI mobile, web and desktop apps can all be built via a single framework, which generally follows the below architecture:
To develop an app via .NET MAUI, you are primarily writing code that interacts with the main .NET MAUI API. The API then directly consumes the APIs of native platforms:
Additionally, app code can also directly exercise platform APIs as needed. .NET MAUI applications can be written using Mac or PC and then compiled into native app packages:
A single project allows for unifying platform-specific development elements into a single shared project targeting various platforms. It uses multi-targeting and SDK-style projects to do so.
.NET MAUI’s single project functionality aims to simplify the cross-platform development process and introduce consistency throughout the whole project, regardless of platform. Among its notable features are:
.NET MAUI is also equipped with cross-platform APIs to access native device features like accelerometer, GPS, battery levels, and network status. More specifically, with .NET MAUI, functionalities for accessing device features include:
.NET MAUI includes support for .NET hot reload, which allows you to modify managed source code and XAML while the app is running and observe modified results without rebuilding from scratch. This is also available for all types of projects on .NET core, not just MAUI.
Usually, source code modification will require manual pausing or hitting a breakpoint. With hot reload, your code edits can be applied to your running app without recompiling.
MAUI also supports XAML hot reload, so you can save XAML files and see changes as the app runs without recompilation. The navigation state, as well as data, will also be maintained, allowing for quick UI iteration without losing your place in the app.
.NET MAUI’s launch in the .NET framework undoubtedly marks a landmark moment in cross-platform app development. .NET MAUI takes Xamarin.Forms’ strengths and raises the bar even higher by adding more functionalities and features for a truly smooth, more integrated app development experience.
Its powerful features, like multi-platform targeting, .NET hot reload, and single project, are set to make developing high-quality, sophisticated apps faster and more cost-effective. Tedious tasks, like testing and debugging, have also been thoughtfully optimised with cross-platform development in mind.
Most importantly, Microsoft has gone the extra mile in ensuring that migration from Xamarin to MAUI is a breeze and that newer users can also easily learn the ropes through extensive documentation and learning guides. All these, combined with the new .NET 8 framework’s improvements and LTS launch, signal exciting times for developers looking to develop high-performance and complex applications across various platforms.
Visit The Virtual Forge website for more content on data, development and technology. We also offer extensive development services, so if you’d like to learn more about building cross-platform apps with .NET MAUI, feel free to get in touch with us.
At The Virtual Forge, we aim to build data-rich, intelligent platforms that solve real-world problems. We use a collaborative approach that lets us know what our clients need so that we can provide efficient and unique solutions for their business problems.
.NET MAUI is built on the same platform as Microsoft XAML. This allows for the development of cross-platform apps via a single codebase.
.NET MAUI can be used to develop a wide range of mobile, web, and desktop apps. It allows developers to create apps for several platforms without needing to code separately for each, saving time, money, and resources.
Have a project in mind? No need to be shy, drop us a note and tell us how we can help realise your vision.