Migrate your app from Xamarin.Forms
You don't need to rewrite your Xamarin.Forms apps to move them to .NET Multi-platform App UI (.NET MAUI). However, you need to make a small amount of code changes to each app. Similarly, you can use single-project features without merging all of your Xamarin.Forms projects into one project.
The documentation for .NET Multi-platform App UI (.NET MAUI) is under construction.
The process for migrating a Xamarin.Forms app to .NET MAUI is expected to be:
- Use the .NET upgrade assistant for .NET MAUI to migrate your Xamarin.Forms projects to .NET MAUI single project, and perform well-known code namespace changes.
- Update any dependencies to .NET 6 and .NET MAUI compatible versions.
- Register any compatibility services or renderers.
- Build and fix any issues.
- Run the converted app and verify that it functions correctly.
Do not currently migrate your production apps to .NET MAUI.
Port an app example
This example ports the Button Demos sample. The process is as follows:
Create a new, blank, multi-targeted .NET MAUI project:
dotnet new maui -n ButtonDemos
Restore the dependencies for the newly created project:
cd ButtonDemos dotnet restore
If you are unable to restore project dependencies, ensure that you have the latest .NET MAUI preview installed.
Copy the code files (except App.xaml) into the newly created project.
In the newly created project, replace the following namespaces:
Old namespace New namespace
Run the app on your chosen platform:
dotnet build -t:Run -f net6.0-android dotnet build -t:Run -f net6.0-ios dotnet build -t:Run -f net6.0-maccatalyst
Examine any run-time errors, some of which will be due to incomplete handler availability.