.NET MAUI is the next generation of Xamarin.Forms, Microsoft's latest cross platform offering. .NET MAUI is the evolution of Xamain.Forms toolkit.
Highlights of .NET MAUI
- Cross Platform, Native UI
- Single Project, Single Codebase
- Deploy to multiple devices, mobile & desktop
.NET MAUI is the successor of Xamarin.Forms . Xamarin is a software company founded in 2011 by the engineers behind Mono, Xamarin.Android and Xamarin.IOS . In 2016 Xamarin has been acquired by Microsoft.
Latest version of Xamarin.Forms, which is 5.0 released in 2021.
The next version of Xamarin.Forms is based on .NET 6. Its been announced that the next version of Xamarin.Forms is going to be .NET MAUI
Currently .NET MAUI is in Preview 4. Check out the official release announcement.
Run the following terminal command to install .NET MAUI Check Tool
dotnet tool install -g redth.net.maui.check
On successful installation of tool you can see the message following message on your terminal.
You can invoke the tool using the following command: maui-check Tool 'redth.net.maui.check' (version '0.5.0') was successfully installed.
Once installation is done, run the following terminal command to install all pre-requisites required for .NET MAUI development
Tool will check for
- OpenJdk / AndroidSDK
- .NET 6 Preview SDK
- .NET MAUI Templates
Whenever tool prompt to "Attempt to fix?", type 'y' to continue. Screen shots show various stages of tool checking pre-requisites
After successful installation, tool shows following message. Press enter to exit.
Connect your Android device in your PC or Launch Android Emulator before start.
Clone official .net maui samples repository
Navigate to cloned path in your pc using command prompt
To build Android project:
dotnet build HelloAndroid
To run Android project:
dotnet build HelloAndroid -t:Run
To launch .NET MAUI Project
dotnet build HelloMaui -t:Run -f net6.0-android
Make sure you have latest preview installed on your PC.
Before running the code, do nuget package addition in visual studio. Create a nuget.config file to the root of your project and add the following feed(s) with these commands:
dotnet new nugetconfig
dotnet nuget add source -n maui-preview https://aka.ms/maui-preview/index.json
In visual studio change target to android, hit F5 run in local device or Emulator
✌️ Your first MAUI App is up and running.
I have created a MAUI application which shows the current battery charge percentage and source of power in an android device.
Check sample application created in Github.
Please check out the official roadmap