Update on .NET Multi-platform App UI (.NET MAUI)

Scott Hunter [MSFT]

The .NET 6 project started in late 2020 as we were finishing .NET 5 where we started the journey to unify the .NET platform runtimes, libraries, and SDK. .NET 5 proved to be a very successful release, the first of the annual November releases, and due to the pandemic, the first all remote team release. Most importantly, it has been rapidly and broadly adopted. This November, .NET 6 will GA and will complete the unification of the mono runtime into core, have one set of base libraries for all workloads, and provide one SDK and project system with an expanded set of operating system and device targets. We will also release the next version of the C# language with C#10, have made several enhancements to the web stack ASP.NET, and improved the development experience with hot reload everywhere. We are also working on the next major release of Visual Studio 2022. There’s a whole lot more improvements coming with .NET 6 in November. Read the RC1 release posts for .NET 6 and ASP.NET Core in .NET 6.

.NET Multi-platform App UI (.NET MAUI) makes it possible to build native client apps for Windows, macOS, iOS, and Android with a single codebase and provides the native container and controls for Blazor hybrid scenarios. .NET MAUI is a wrapper framework and development experience in Visual Studio that abstracts native UI frameworks already available – WinUI for Windows, Mac Catalyst for macOS/iPadOS, iOS, and Android. Although it’s not another native UI framework, there is still a significant amount of work to provide optimal development and runtime experiences across these devices.

The .NET team has been working hard with the community in the open on its development and we are committed to its release. Unfortunately, .NET MAUI will not be ready for production with .NET 6 GA in November. We want to provide the best experience, performance, and quality on day 1 to our users and to do that, we need to slip the schedule. We are now targeting early Q2 of 2022 for .NET MAUI GA.

In the meantime, we will continue to enhance Xamarin and recommend it for building production mobile apps and continue releasing monthly previews of .NET MAUI. All the features we plan to deliver for .NET MAUI will be available in November when .NET 6 releases, but we will continue to work on quality and addressing customer feedback. We encourage you to give the previews a try. The .NET Upgrade Assistant will also support upgrading Xamarin projects to .NET MAUI.

.NET 6 RC1 is a “Go Live” release, meaning you can use it in production and you will be supported. This excludes .NET MAUI packages. The next release of .NET MAUI packages, when .NET 6 RC2 releases, will indicate “preview” in the version.

Thank you for all the feedback, contributions, and excitement that you have shared with us on this journey. Please keep it coming and we look forward to a high-quality release early next year. Now let’s look at some of the new features in this release.

.NET MAUI Preview 8 Highlights

The September preview of .NET MAUI completes some important Visual Studio integrations, namely installing .NET MAUI as a workload in the Visual Studio 2022 installer, and folding the Windows platform inside our single, multi-targeted project. With Visual Studio 2022 Preview 4 you can now use broader Hot Reload support with C# and XAML, and the new XAML Live Preview panel for a productive, focused development environment. Within the .NET MAUI SDK itself, preview 8 includes updates to the app startup pattern, the ability to extend a handler, and miscellaneous other new control capabilities as we close on feature completeness.

Visual Studio 2022 Preview 4 Productivity

When installing Visual Studio 2022 Preview 4, you can now check .NET MAUI (preview) within the Mobile Development with .NET workload. This will bring in .NET 6 as well as the optional workload dependencies: Android, iOS, and Mac Catalyst. When targeting desktop, you’ll also want to choose the Desktop Development with .NET, UWP, and Desktop Development with C++ workloads.

image of installer

Once installed, the .NET MAUI templates and features of Visual Studio are all available. Live Preview will mirror your running application within the Visual Studio window in a panel you can dock anywhere that’s most convenient to you. The panel supports zooming in and out to focus on every detail of your UI, guides to align elements on both horizontal and vertical axis, and on some platforms you can hover and select UI elements to get sizing and distance information.

Hot Reload for XAML and C# together with XAML Live Preview

XAML Hot Reload now works well on Android, iOS (on Windows via Hot Restart or a remote build host), and Windows. And .NET Hot Restart is working together with XAML Hot Reload on Android, iOS, and Windows too.

When you create a new project, you’ll now see the Windows platform is alongside Android, iOS, and Mac Catalyst within the Platforms folder. To use Windows, you first need to install the Windows App SDK extension for Visual Studio 2022, and then uncomment the TargetFramework node at the top of your csproj file. In a future release, this will be available by default with the extension pre-installed with .NET MAUI.

.NET MAUI SDK Updates

The most notable update that you’ll need to migrate existing applications to is how we implement the .NET Host Builder pattern. We are now aligned with how ASP.NET and Blazor do this with a MauiProgram class that creates and returns a MauiApp. Each platform now calls that MauiProgram.CreateMauiApp. Compare an existing project with the new templates, or the pull request, to see these changes to Android/MainApplication.cs, iOS/AppDelegate.cs, and macCatalyst/AppDelegate.cs.

Sample MauiProgram:

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .ConfigureFonts(fonts =>
            {
                fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
            });

        return builder.Build();
    }
}

Sample of the Android MainApplication:

public class MainApplication : MauiApplication
{
    public MainApplication(IntPtr handle, JniHandleOwnership ownership)
        : base(handle, ownership)
    {
    }

    protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}

Android Updates

Android 12 (API 31) is now the default for .NET 6 applications building for Android. To use Android 12, you’ll need to install JDK 11 manually. Once we update the Android tooling in Visual Studio to use JDK 11, we’ll bundle this dependency by default with .NET MAUI. Until then, JDK 11 may have an unfavorable impact on the Android designer, SDK manager, and device manager.

Android projects now use the MaterialTheme by default. Make sure Platforms/Android/MainActivity.cs specifies @style/Maui.SplashTheme or you may get runtime errors on Android. Review the updated .NET MAUI template for example.

Other Changes

Other notable changes and additions include:

  • MinHeightRequest, MaxHeightRequest, MinWidthRequest, MaxWidthRequest have dropped the “Request” suffix and the layout system now treats them as true values
  • Simplified method for appending behavior to any control mapper – #1859
  • Various improvements to Shell theme styling
  • Added RefreshView for Android #2027 and iOS #2029
  • Added AbsoluteLayout #2136
  • Added Right-to-Left (RTL) FlowDirection #948
  • Added Button.Icon ImageSource #2079

Get Started Today

First thing’s first, remove all previous installations of .NET 6 and Visual Studio 2022 previews from your Windows control panel. Now install Visual Studio 2022 Preview 4 and check .NET MAUI (preview) under the Mobile Development with .NET workload, the Desktop Development with .NET workload, Desktop Development with C++ workload, and Universal Windows Platform.

Now, install the Windows App SDK Single-project MSIX extension. Before running the Windows target, remember to uncomment the framework in the csproj file.

Ready? Open Visual Studio 2022 and create a new project. Search for and select .NET MAUI.

Visual Studio 2022 new project dialog

For additional information about getting started with .NET MAUI, refer to our documentation.

Feedback Welcome

Visual Studio 2022 previews are rapidly enabling new features for .NET MAUI. As you encounter any issues with debugging, deploying, and editor related experiences, please use the Help > Send Feedback menu to report your experiences.

Please let us know about your experiences using .NET MAUI to create new applications by engaging with us on GitHub at dotnet/maui.

For a look at what is coming in future releases, visit our product roadmap, and for a status of feature completeness visit our status wiki.

89 comments

Discussion is closed. Login to edit/delete existing comments.

  • Damian Wyka 0

    Im getting 500 errors when installing single-project extension. Again i might add. (in preview 6 i had this error, fixed in 7 and is back in rc1)

    Also why the heck Android is required to start Window program is beyond me…..

    • David OrtinauMicrosoft employee 0

      Are you getting a 500 within Visual Studio 2022? Try downloading the extension from the web browser and then installing it by dbl-clicking it.

      Single project, multi-targeted projects build every target framework right now, no matter which one you are focused on. This will be fixed by the time we GA so that if you are running Windows you can choose to only build Windows.

      • Damian Wyka 0

        yes from vs 2022. if android dependency is going to be fixed then thats great.

  • Andrew Tech Help 0

    Heya, 🙂

    What does this mean for Xamarin.Forms? Does this mean that Xamarin.Forms will be compatible with iOS 15/Android 12 SDKs and .NET 6.0 when they release later this year because .NET MAUI won’t be ready until next year?

    • David OrtinauMicrosoft employee 0

      Xamarin and Xamarin.Forms have always been scheduled to support modern platforms through November 2022, so yes we have support for iOS 15 and Android 12 on the existing .NET Framework.

      Xamarin.Forms will not be moving to .NET 6 alone – the migration is to .NET MAUI in 6. We did consider what this would look like to bring Xamarin.Forms to .NET 6 and it was not actually advantageous to customers. The lengthened timeframe is for us to improve the quality and completeness not just of the .NET MAUI SDK itself, but all the pieces of the stack below it such as the .NET 6 platforms, build tooling, IDE features, workload installation, and more.

      • Andrew Tech Help 0

        Thanks David, appreciate the answers. Makes sense. We’ll continue to use Xamarin.iOS and Xamarin.Android with Xamarin.Forms on top (with iOS 15 and Android 12 support soon hopefully) until .NET MAUI is available next year and then look to migrate to .NET 6.0 and .NET MAUI together 🙂

  • TSX 0

    Will finished MAUI be ready for VS 2019 ?

    • David OrtinauMicrosoft employee 0

      .NET MAUI and .NET 6 features are in Visual Studio 2022. They are not being backported to 2019.

      • Felix Patric 0

        How i wished all .net workloads are independent from any iterations of new IDE. I still love my visual studio 2015, I upgraded it to 2017 due to the fact that .net is now open source and i loved the new asp.net core mvc templates that came with it but when folks from Redmond introduced Blazor, i had to upgrade yet again to VS 2019.

        • David OrtinauMicrosoft employee 0

          You can install and use all our SDKs from command line and your choice of code editor (VS Code for example). So in that respect, it is completely independent. However, VS 22 is going to provide the best end-to-end developer experience and so that’s the path we want to encourage you to use.

  • saint4eva 0

    Now that .NET Maui has been delayed, this is a wonderful opportunity to bring in Comet C# MVU into the fold. It is quite surprising that .NET Maui started by advertising C# MVU, but later moved to XAML once more. Xaml slows development down, just ask WinUI team. xaml takes a lot of resources to develop. For .NET Maui to favourably compete with swiftui, RN and flutter, you need a C# MVU; for end-to-end mobile solution development using only C#. ASP.NET Core has already achieved that – little wonder they are remarkably successful.

    • David OrtinauMicrosoft employee 0

      We are excited to share Comet more widely alongside .NET MAUI. They share the same core infrastructure so we aren’t duplicating that work. James Clancey is rapidly updating Comet with each .NET 6 release.

    • Stevie White 0

      I will have to disagree with the notion that XAML slows down development 🙂

      I suspect it is also since I originally came from a web dev background so XAML felt “right at home” for me after dealing with the sluggish nature of Windows Forms.

      But I won’t disagree on the idea that Comet itself should get some more love. I find it compelling, but I think it definitely needs more work before I could consider using it for anything.

  • MaxHugo 0

    MS should invest more resources in this project.

  • Nicolas Faucher 0

    Problem when trying to debug Windows target of a new MAUI project. I installed all dependencies and uncommented the line in the project file (TargetFrameworks). It debug correctly for Android, but when trying to debug Windows (WinUI), I have a deployment error and in the output: Need recipe file.
    What is missing? Thanks.

  • Sergio Jr 0

    Even with a fresh install of VS Preview 4 (with MAUI Preview checked) and MSIX extension, the new project templates doesn’t appear in the search results. What am I missing?

    • Sergio Jr 0

      I also notice problems with blazor templates. It seems like they were not updated at all.

  • Juan Sturla 0

    AbsoluteLayout is back for good then? I thought that it was going to be compatibility only
    What will happen to RelativeLayout?

    • David OrtinauMicrosoft employee 0

      We heard feedback that AbsoluteLayout was an important control, so we prioritized bringing it to .NET MAUI rather than leaving it in the compatibility package. We haven’t heard the same for RelativeLayout, so that’s an outstanding question. Shoot me a message and let me know how you’re using RelativeLayout today and what the impact would be of us not porting it to .NET MAUI. david.ortinau@microsoft.com

  • Asumege Alison 0

    It’s sad to see that we developers on ‘Xamarin native’ are not receiving any updates regarding the SDKs, APIs and tooling. .NET MAUI is amazing, but not everyone is into the business of make one app run everywhere. There are real benefits with using native Android and iOS APIs for anything more complex than simple business apps. Would love hot reload for Android xml layouts for example.

    • David OrtinauMicrosoft employee 0

      Much of what you get in .NET MAUI applies to Android and iOS. As it sounds like you are aware, it’s all native platform APIs so you can use as much or as little Android XML layout (for example) as you like. Even when targeting a single platform, we are making .NET MAUI a great option.

      As for bringing things like hot reload to Android XML, we have no immediate plans for that. We will continue to listen to developer feedback and assess the opportunity relative to other investments.

  • Benjamin Noffsinger 0

    If you are pushing the .Net MAUI GA date, shouldn’t you also push the Xamarin Forms end of life date? It’s a pretty tight timeframe between “early Q2” and November. A year was already going to be tight. So at this point, we are likely to have Xamarin Forms apps in production still in November. Our customers would certainly feel better about that if Xamarin Forms was still officially supported by Microsoft.

    • David OrtinauMicrosoft employee 0

      Yes, we expect to extend Xamarin support to provide time for migration to .NET 6. We recognize the ecosystem of libraries also needs time to update.

      • Benjamin Noffsinger 0

        Excellent. Thank you, David.

Feedback usabilla icon