What Does Migrating From Xamarin To MAUI Mean For App Development?

Microsoft is always on the lookout for the latest disrupting technologies and tools. The company’s major next step in evolving its cross-platform development offerings is MAUI. But what is MAUI? Is it replacing Xamarin? Are they different technologies? Read on to find out.

If you’ve dabbled in cross-platform app development or are an expert at it, then you may have worked with Microsoft’s development ecosystem at least once. If this is the case, then you might have surely heard of Xamarin or worked with it. This cross-platform app development framework goes back all the way to 2011 but has been Microsoft’s bannerman within the development industry since 2016 when they acquired it. 

In a nutshell, Xamarin allows developers to ship applications that function on all platforms using C# code and Visual Studio. In addition, it works with a shared codebase that enables developers to write code once and reuse around 75% of it for all platforms and operating systems. Thanks to these, and more features, Xamarin has been a staple in the development industry for several years. However, now, Microsoft has seemingly changed the rules of the cross-platform development game for good with the introduction of its latest disruptive framework. 

For decades now, Microsoft has released countless additional tools and technologies that have made developers’ jobs a lot easier. So, we can safely conclude that, at the gates of 2022, the natural next step of Microsoft’s app development efforts is to create the next generation of cross-platform app development frameworks. But, by any chance, are you thinking they’re releasing the next update for Xamarin? A sort of Xamarin 2022? Well, that’s not quite what Microsoft had in mind, and, at their 2020 Build conference, the tech giant introduced their new framework for cross-platform app development: .NET Multi-platform App UI (.NET MAUI). 

This article will dive deeper into what .NET MAUI, or simply MAUI, is, how it impacts Xamarin app development, what the most significant modifications are compared to Xamarin, and if you should migrate to MAUI and what that means. 

What is .NET MAUI?

As we mentioned earlier, Xamarin has been part of the app development family for more than a decade. For us at Foonkie Monkey, it has played a decisive role in our cross-platform app development practices. And we’re sure that has also been the case for countless other developers who have been successfully delivering innovative, disruptive, and robust apps over the years. Finally, however, it seems the time has come to say goodbye to Xamarin and hello to MAUI. But is that a good or a bad thing? Let’s see.

MAUI, or .NET MAUI, as Microsoft has officially named it, stands for .NET Multi-platform App UI, and it’s an open-source, written in C#, cross-platform app development framework for building mobile and desktop applications using a single, shared codebase. MAUI, whose GA (general availability) isn’t scheduled until the second quarter of 2022, runs on .NET6, the latest version of .NET, which was fully released in November 2021. NET is a Microsoft-owned free, open-source, cross-platform framework that allows developers to build different types of applications, from web and IoT to mobile and desktop, using multiple languages, editors, and libraries. 

NET6 is the latest evolution of the .NET platform. It combines all of its predecessors’ benefits to deliver a faster, more efficient framework that allows developers to add source codes and more robust and capable resources specific to each platform. That being said, MAUI will run on the new .NET6 framework so that developers can use a single codebase with built-in resources to integrate with native APIs for all operating systems (iOS, macOS, Android, and Windows). It sounds like a lot of bells and whistles, but, essentially, MAUI is the next iteration of Xamarin, so we can say that, instead of Microsoft giving us Xamarin 6, we are getting .NET MAUI. 

At first glance, Microsoft’s intention with the release of .NET MAUI is to allow developers to build a more simplified project structure. As opposed to Xamarin, where you had to create a project for each platform, with MAUI, you will only have to build the app once, with a single codebase, and in a single Visual Studio project that will contain all the resources to target all supported devices and platforms. And, if the need arises, it allows you to add different resources and source codes for different platforms. 

Furthermore, with MAUI, you can also bundle all native APIs in a single view and use them to compile when targeting each platform’s builds. Additionally, you can bundle all the resources that you will use when building your app’s UI using XAML, such as images and fonts, for instance. As a result, you have one place where all the application elements are visible and compiled, giving you a more effective means of managing them. This way, MAUI is set to reduce the complexity of building apps for multiple platforms and make the overall development experience more accessible and enjoyable. 

At this point, you’re probably thinking, is it just a name change? Or is MAUI more than just Xamarin’s next-gen version? Do I need to change EVERYTHING when migrating from Xamarin to MAUI? Well, MAUI actually IS pretty much a recast of Xamarin’s stack, but it is also much more than that. So let’s look at some of what has changed from Xamarin to MAUI to try and contextualize what migrating to MAUI really means for app development.

From Xamarin to MAUI, What Has Changed?

Well, a lot. First of all, with MAUI, Microsoft will fulfill their (or our?) dream of fully infixing Xamarin into .NET and consolidating all runtimes, SDKs, and libraries into one single platform. Since day one, Microsoft wanted Xamarin to be part of their unified developer experience, but the cross-platform development tool hasn’t quite felt an integral part of the .NET ecosystem. Xamarin has scars that Microsoft has wholeheartedly tried to heal, which is a big part of the reason why Xamarin is now destined to “disappear.” Moreover, Microsoft also wanted .NET with C# to be the dominant language for app writing, where app developers can code once and run everywhere in a unified environment. However, this unification could only take place if and when Xamarin was wholly integrated into the .NET universe, which has been Microsoft’s ambition since they purchased the platform some six years ago. 

So, to accomplish the unification of Xamarin into a global .NET development environment, Microsoft has taken it, transformed it, and created MAUI. They also injected it with a few new features and functions that will make the entire developer experience better, faster, and more scalable. 

Here are the main changes you will experience when migrating from Xamarin to MAUI.

1. MAUI addresses app performance and load times issues

Xamarin has been countless developers’ go-to solution for cross-platform app development for several years now. It has helped deliver popular and innovative apps for world-class organizations such as Alaskan Airlines and The World Bank. We at Foonkie have used it for years now, and we have to say we do love our Xamarin Apps! Nonetheless, we have to agree that some apps out there built using Xamarin have performance issues. These issues are mainly due to slow app load times and the considerable size of the apps that Xamarin produces, which have been ongoing concerns within the developer community for a while.

One of the reasons for these loading times issues is Xamarin’s renderer architecture. Renderers are not very intuitive pieces of code that, well, consistently render control to the screen across each platform. This way, developers can create custom renderers in Xamarin to ensure the apps retain the appropriate look for the respective platform they’ll be running on. However, renderers are a big nuisance under certain conditions and when working with a particular project, which is why they are slowly but surely becoming obsolete. With MAUI, Microsoft is rebooting them and calling them handlers. Don’t worry; we’ll dig deeper into handlers later on. 

2. MAUI entirely runs on .NET

With MAUI fully running on the latest version of .NET, .NET 6, Microsoft has officially welcomed us to the onset of a global, unified .NET. world for modern app development practices, which is huge for our industry. As we all know, Microsoft has always prioritized developer productivity. Now, with a global .NET environment, developers no longer have to navigate countless variations of .NET such as NET Core or Mono, to name a few. In that sense, Xamarin, which was never fully integrated with .NET, will now be “absorbed,” if you will, into this newfound universal framework. This way, Xamarin will finally be an integral part of .NET in the form of MAUI. 

Additionally, with .NET’s long-awaited unification in .NET 6, which Microsoft had already started in November 2021 with .NET 5, the .NET universe is no longer fragmented, leading to unified runtimes, project efficiency, and better tooling, all of which are meant to inspire unparalleled developer confidence and efficiency. So, with MAUI, everything is now part of a larger ecosystem where everything is found in a single place that provides constant support from everyone working on the .NET platform, creating a more extensive support community, one of Xamarin’s most significant flaws. 

All of the above will promote perception changes that will make MAUI the only existing .NET way of cross-platform app development. 

3. MAUI introduces single projects

If you have ever used Xamarin, you already know the hassle of creating a different project for each target platform. If you were, let’s say, developing an app for both iOS and Android, then you needed to work with the leading platform project and then one project file for iOS and one project file for Android. Of course, for most seasoned developers, having to work on separate projects isn’t the end of the world, but having to do a hundred different things for each project is kind of a nuisance. Isn’t it? 

However, with MAUI, this issue is fixed with the introduction of single projects. MAUI gives us the chance to work inside a single interface with one project file where we can write either cross-platform or platform-specific code, depending on the app we’re developing. As a result, we can now write inside a single, consolidated project that runs on multi-targeting and produces executables for each target platform without modifying the base code! This way, MAUI has the potential to foster unparalleled re-usability, reduce the complexity of cross-platform app development, improve the developer experience, and make MAUI and .NET more competitive, which can ultimately make Microsoft the go-to service for developers all over the world.

4. MAUI and Blazor

MAUI’s advantages aren’t entirely dependent on it being the evolution of Xamarin. Aside from potentializing Xamarin and fixing its issues, MAUI also introduces new features such as writing web applications with Blazor, a .NET framework that allows developers to build client-side web UI using C# instead of JavaScript. In addition, Blazor makes code and libraries shareable, and now, we can host these and more, Blazor components in MAUI apps! 

But why is that so great? Because we can use Blazor along with MAUI to build cross-platform apps using web UI, meaning that all components run natively in .NET, giving you access to native functionalities via the .NET platform. In that sense, MAUI lets us create Blazor cross-platform apps that can run on desktop but also on Android, iOS, and macOS.

5. MAUI introduces handlers

Those of us that have worked with Xamarin before knowing the intricacies of making it all work. The tooling, the complex way the code is built, the multiple project files, and the resulting heavy and slow app, to name a few, are some of Xamarin’s roadblocks for cross-platform app development. However, one of our biggest Xamarin pet peeves is that if for whatever reason something is missing from your project, or you need to make changes, you have to write a custom renderer for every target platform. And, as we touched on earlier, renderers can be an annoyance, to begin with; imagine having to use them every time you want to change something. With MAUI, Microsoft tackles these issues with handlers, an architectural component that maps cross-platform controls and translates them into their native implementation on each target platform. 

Unlike renderers, handlers are faster, easier to use, highly customizable, and global, meaning you can modify them anywhere inside your MAUI app. Additionally, you can easily change each platform’s handler without creating a new one for each change you make, a feature made possible thanks to handlers being decoupled. Finally, this decoupling makes handlers reusable between projects, and we can use them to initiate actions, display collections and data, and much more.

 

6. MAUI enhances Hot Reload

Hot reload is a great feature that allows us to modify the app’s source code while it is running without stopping the product’s execution and then restart it to see the code changes. However, as you may already know, Hot Reload isn’t new in MAUI. Xamarin already enjoyed some of the benefits of Hot Reload. The difference is that in MAUI, we will find Hot Reload support for all C# files. As a result, MAUI saves us countless app restarts, rebuilds, and re-navigations, making the development process faster, easier, and making us more productive. 

We could go on and on about MAUI’s features and changes when compared to Xamarin, but since we can’t dig as deep as we want in all of them, here are some broad ideas of some of the other changes we will indeed witness when migrating from Xamarin to MAUI:

  • MAUI provides the option of platform-specific customization where we can fully customize our app’s UI and behavior for each individual platform. 
  • MAUI has a layout engine for creating pages.
  • MAUI supports data-binding, a process that connects the app’s UI with the data it displays, leading to better-looking and maintainable elements.
  • MAUI has a considerable graphics library for all platforms, allowing us to mix and match them as we please to achieve a particular look for a specific project.
  • MAUI has APIs to access native device features that allow devices to retrieve information from GPS, cameras, or batteries, among others.
  • MAUI is a layer on top of native platform APIs, which results in fully native apps. This way, apps developed on MAUI will look and behave just as native apps would. 

 

Should you migrate from Xamarin to MAUI?

The million-dollar question. So, should you? The only answer and the most straightforward one we can give you is yes, you should. As we touched upon several times earlier, since MAUI is Xamarin’s direct descendant and offers a myriad of enhancements, new features, and advantages that further potentialize your cross-platform app development endeavors, then yes, it makes perfect sense for you to upgrade to MAUI. There’s no way around it; it is the only logical next step for app developers who are always at the forefront of modern technologies and are known for delivering innovative solutions. In that sense, there should be no question about migrating to MAUI. And, seeing that Xamarin is destined to disappear, you will probably have to. So, the only question that remains is: when to upgrade?

As per Microsoft’s suggestion, we should start projects with MAUI once it’s officially released and generally available, which, as we mentioned earlier, won’t happen until the second quarter of 2022. They have, however, released 12 MAUI previews so far with tons of new capabilities, documentation, improvements, and performance corrections aimed at making the final release of MAUI as flawless as possible. Furthermore, and to our relief, Microsoft has also promised to make the migration from Xamarin to MAUI as seamless and straightforward as possible. We’re not sure how seamless it will actually be. Still, considering the tech giant’s history of making developers’ lives easier, we’re sure the migration will take place in the simplest way. I guess we’ll wait and see. In the meantime, we can test the latest MAUI, Visual Studio, and .NET 6 previews here and get acquainted with what working with them will be like.  

But let’s get to the point. Migrating from Xamarin to MAUI and its timing really depends on your company and the type and size of the projects you currently have underway. If you have small apps, then you can migrate them without too much hassle. However, for larger projects or those you still have under research but haven’t started yet, it may be a good idea to wait until Microsoft has more tools and further support and documentation to help your migration more manageable and safer. Still, here are some scenarios to consider when making your transition from Xamarin to MAUI:

You’re already using .NET: If you and your team have already worked with a .NET stack and have mobile or desktop products and software built on it, then migrating to MAUI is the next natural step for you. You can easily leverage the knowledge your team already has to make the transition as smooth as possible. You can also reuse most libraries and business logic and most of the UI code with the help of Blazor.

You have experience in cross-platform app development: Same as above. If you already have experience with cross-platform app development, you can easily leverage that knowledge and apply it when migrating from Xamarin to MAUI. Sure, some aspects will be different, and the project setup might not be what you’re used to, but the everyday coding and the overall concepts, components, and dynamics are basically the same.  

You’re currently working with Xamarin: If right now, you have one or more projects underway, or starting, that you’re going to develop using Xamarin, it may be a good idea to wait so you can upgrade to MAUI as quickly as possible when Microsoft is ready to provide the tools and paths to simplify the process. Don’t start migrating your apps that are currently under production! That being said, make sure you make the upgrade as soon as MAUI becomes widely available, not before, so you can benefit from all its enhancements, improvements, support, and data. We know there is still some waiting to do until MAUI’s GA is a reality, but waiting to have the complete information, tools, and documentation will significantly minimize the chances of mistakes and the effort needed to perform the migration. 

So, with all that information and your own research, are you ready to take the plunge into MAUI? If you are, here’s the sequence suggested by Microsoft to make the migration from Xamarin to MAUI in the best, cleanest, and fastest possible way.

Migrating From Xamarin To MAUI

Doing a step-by-step of what the transition to MAUI entails would require writing a whole other 1,000-word article, but, for the purpose of being thorough, we’ll highlight the main steps you should be ready to take when the time to migrate comes as per Microsoft’s suggestions and expectations: 

 

  1. Microsoft will provide a .NET upgrade assistant for developers transitioning to MAUI, so use it to migrate all Xamarin projects to one .NET MAUI project. In addition, you should perform all the well-known code namespace changes required.
  2. Next, you must update all dependencies to the compatible versions of .NET 6 and MAUI.
  3. Afterward, make sure to register all compatibility services or renderers.
  4. Build, making sure to fix any issues or glitches that arise.
  5. Finally, run your converted app and check to ensure it functions properly.

 

We discussed these steps very broadly, the transition to MAUI entails much more, and we will update as more information becomes available. In the meantime, we hope we’ve managed to shine some light on most concepts and ideas relevant to Microsoft’s new framework and, hopefully, you’re now ready to make an informed decision.

 

From Xamarin to MAUI: The Takeaway

Even though MAUI’s full availability is still some months away, cross-platform app developers, and even native ones, have a lot to look forward to and be excited about. From its improved architecture and advanced features to its tooling and usability, Microsoft designed MAUI with the sole purpose of enhancing developer productivity.  And we’re sure it will accomplish that and much more. In the meantime, the most significant thing you can do for your company is to start researching, documenting yourself and your team as much as possible and preparing to make the transition when the time comes. For that, and before you run to install MAUI, you can check MAUI’s FAQ page on GitHub, which has excellent resources and is very well nurtured in terms of information about the framework. You can also head over to Microsoft’s very own .NET MAUI documentation page and blog to start familiarizing yourself with the ins and outs of what migrating from Xamarin means for you and your company.  

 

If you’ve been following us for a while or have checked out our page, then you know about our history with cross-platform app development and Xamarin. So, if you need more information or want to work with us, don’t think twice about contacting us so we can chat and help you out!



Need Help with a Project?

drop us a line and Let's start to Work!