Microsoft has developed an advanced and feature-loaded cross-platform framework called .NET Multi-platform App UI or .NET MAUI, which can be used for developing native mobile and desktop apps via C# and XAML languages.
With .NET MAUI, developers can use a single and shared codebase to develop applications that can seamlessly run on Android, iOS, macOS, and Windows.
Note here, that .NET MAUI is still in preview, and the information shared in this blog has been derived first-hand via pre-release product. Once the final version is released, there can be some changes in the features.
.NET MAUI: Evolution of Xamarin.Forms
.NET MAUI is a framework, that is open-sourced, and is considered to be an extension of Xamarin.Forms, powered with fascinating UI controls built from scratch, and extends the development dimension from mobile to desktops.
Enhancing performance and extensibility of the mobile and desktop apps are the core objectives of .NET MAUI framework.
While there are several similarities between .NET MAUI and Xamarin.Forms, there are several differences as well: With .NET MAUI, developers can not only create multi-platform apps via single project, but also append platform-specific codes and resources, to enable unprecedented customizations and optimizations.
The makers behind .NET MAUI ensured that using one single, sharable codebase, the developers are able to use maximum app logic and UI layout.
And this changes everything.
Here is the architecture of a .NET MAUI app:
.NET MAUI: Key Highlights
With .NET MAUI, developers are able to use controls for specific tasks such as display collections, initiate actions, display data in runtime, indicate activity, pick data and more.
Here are the key highlights of .NET MAUI framework:
- Comprehensive and elaborate layout engine, which is used for designing pages
- Feature to create rich navigation types, like drawers, via support for multiple page types Data-binding support provided, to creating maintainable development patterns.
- Presentation of UI handles is enhanced via customize handlers
- Feature to deploy essential cross-platform APIs for accessing native device features. With this, the app can access device features such as GPS, the accelerometer, and battery and network states and more.
- Highly advanced cross-platform graphics functionality
- With hot reload, the developers can modify and work on both source code and XAML code, while the app is running. Hence, the modifications can be checked, without rebuilding the app.
How to create your 1st app on .NET MAUI
Here is the step-by-step guide to create your 1st ever app based on .NET Multi-platform App UI.
But before that, let’s find out the prerequisites:
- Latest preview of Visual Studio 2022 17.2, with the required workload. For more details, visit here.
- For maximizing Android emulator performance, Hardware acceleration should be enabled. For more details, visit here.
Now, let’s dive straight into the step by step process to create your 1st app on .NET MAUI in Visual Studio 2022 17.2 Preview, and then run the app on an Android emulator:
Step 1: Launch Visual Studio 2022 17.2 Preview, and then click on ‘Create A New Project’.
Step 2: Select MAUI in the Project type drop-down, and then select .NET MAUI App (Preview) template. Click next.
Step 3: Configure your new project window will open, wherein name your project, select a location to save it and click next.
Step 4: The system will create the project, and the dependencies will be restored.
Step 5: The Android SDK License Acceptance window will open. Accept button needs to be pressed.
Step 6: User Account Control dialog will open. Press Yes button.
Wait for the Visual Studio to download the Android SDK and Android Emulator.
Step 7: Press Android Emulator button in the Visual Studio toolbar
Step 8: A User Account Control dialog will open. Press Yes
Step 9: New Device window will open. Click Create button
Step 10: Press Accept button in the License Acceptance window
After this, Android emulator will be downloaded, unzipped and created by Visual Studio
Step 11: Close the Android Device Manager window
Step 12: Press the Pixel 5 - API 30 button in the Visual Studio toolbar, which will build and run the new app
Step 13: While running the Android Emulator, press the Click Me button several times, and observe how the counter is increasing with every click.
And your app is now live!
Connect with our .NET MAUI app development company to launch your new cross-platform app based on this amazing new framework.