What steps should you take when preparing to migrate your app from Xamarin.Forms to .NET MAUI? This list will help you think it through.
In the previous post, we reviewed the pros and cons of migrating our code from Xamarin.Forms to .NET MAUI. In this post we will highlight the major points of planning the migration.
In short, these are the things that are good to consider before starting:
This is a basic but very important step for our process. Installing the latest version of VS 2022 or VS for Mac should set up most all that you need to start your development. Still, for Mac there are some additional requirements, such as:
Note: Full steps can be found on Microsoft’s documentation site—check it for latest updates.
Once you are ready, you will be able to start with a basic .NET MAUI app—which is a great starting point. Create one and have a look at it as we will use it as reference during the migration.
Another important tool that we will use during the migration is .NET Update Assistant. You can now download it too from VS MarketPlace, but I still recommend it to use it via cmd as the extension has some limitations. You can install it simply with the following command:
dotnet tool install -g --add-source "https://api.nuget.org/v3/index.json" --ignore-failed-sources upgrade-assistant
Now is a good time to review how the code separation is handled in your app and to decide whether to migrate it directly or consider changing it as .NET MAUI support improved MVVM support and a new MVU pattern is also added.
If you already using MVVM in your app, it is more natural to stay on it. It’s a great and widely used pattern. But if this is the case, there are some other important notes to consider if you use one of the popular MVVM helper libraries:
MVVM cross is popular for Xamarin, but currently not supported with .NET MAUI. As an alternative, you can rely purely on the built-in MVVM MAUI support or consider using MVVM Community toolkit.
.NET MAUI supports great shell navigation and every sample .NET MAUI app contains a template ready to start with. If you do not use shell navigation, consider this change as a step in the migration plan: .NET MAUI Shell navigation - .NET MAUI | Microsoft Learn. Using basic page navigation is also an option: FlyoutPage, TabbedPage and NavigationPage.
This is an important step in preparation. Check this in advance and find alternatives of your APIs if not.
One such library is Progress Telerik UI for Xamarin—don’t worry, we’ve got you covered. You can replace it safely with Telerik UI for .NET MAUI. (Download it here!)
Where is your data service published? What kind of login authentication do you have? Take a step to consider the usage of Azure for all of these if you still haven’t.
If your mobile already uses Azure, an important note is that Microsoft.WindowsAzure.MobileServices are now rebranded as Microsoft Datasync.Client. Read a full explanation and sample in Microsoft docs: Build a .NET MAUI app with Azure Mobile Apps | Microsoft Learn—or in one of our next posts where we will integrate Telerik .NET MAUI app and Azure mobile .😊
So plan migration of Azure references as a separate step and read resources before that.
With .NET MAUI Windows, support is focused more on the desktop side, so now is time to consider whether you need to polish the UI of the Windows version to be a little better for your desktop users. If Windows is not a priority for you, you can still leave this part for debugging and easy development purposes.
Consider their migration to .NET MAUI handlers by preparing yourself with handlers architecture and following our series where we will describe the options here—should we use the handlers architecture or migrate the renderers directly?
There are some API changes when migrating from Xamarin.Forms to .NET MAUI. We will review them in the next two posts explaining how we managed to migrate our ERP app.
Rossitza Fakalieva was a leader of Telerik engineering teams working with XAML technologies—Telerik UI for WPF, Telerik UI for Xamarin and Telerik UI for .NET MAUI.