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.

  • Rand Random 0

    Sad to read that you had to push back MAUI. 🙁
    Though I kind of anticipated it, because it never seemed the project caught up to the delays at the very beginning. eg. https://github.com/dotnet/maui/issues/274

    • Pony Speed 0

      Agreed, the signs are all there. If you look at MAUI doc regularly, at https://docs.microsoft.com/en-us/dotnet/maui/. You will notice the official doc has almost no update for the past 2-3 preview cycles, and it contains so little information. MAUI is a major efforts, and if it slips, it is totally understandable. But what happened here is MAUI teams know it’s going to take a lot more time for quite sometime now, and it is not telling us, and that is very unprofessional. I have a suggestion for Mr. Scott Hunter, please make sure the doc is updated as regularly as the code base, this is a sure sign that MAUI project is stable and on track.

      • David OrtinauMicrosoft employee 0

        I recommend looking at https://github.com/dotnet/maui for an accurate picture rather than the docs portal. On GitHub we manage project boards and regularly update the Wiki status, plus you can see the ongoing pull requests.

    • Kevin E. Ford 0

      It seems reasonable based on where the last preview was at. It seemed like an insurmountable hurdle for them to finish everything that needed to be done in the original timeline.

  • Nicolò Carandini 0

    I need some clarification to get started in Windows (please note I’ve installed the Preview7):

    On the “ASP.NET Core updates in .NET 6 Release Candidate 1” post is written:
    1) To get started with ASP.NET Core in .NET 6 RC1, install the .NET 6 SDK.
    2) Install the latest preview of Visual Studio 2022.
    3) To get setup with .NET MAUI & Blazor for cross-platform native apps, see the latest instructions in the .NET MAUI getting started guide.

    On this post “Update on .NET Multi-platform App UI (.NET MAUI)” you wrote:
    1) Remove all previous installations of .NET 6 and Visual Studio 2022 previews from your Windows control panel.
    2) 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.
    3) Install the Windows App SDK Single-project MSIX extension.
    4) Before running the Windows target, remember to uncomment the framework in the csproj file.

    My questions:
    1) Do I really need to remove all previous installations of .NET 6 and Visual Studio 2022 previews from your Windows control panel,
    or having the Preview 7 stuffs I can just install the latest .NET 6 and update mi VS2022 from beta 3 to beta 4 via the VS Installer?

    2) Is maui-check still a thing?

    • David OrtinauMicrosoft employee 0

      The new install doc is in review and will publish soon. In the meantime:

      You may be fine to not remove previous .NET 6 previews however I did encounter a situation where Visual Studio 2022 didn’t install Android because it thought I had a newer version I had installed via CLI. To avoid that, I recommend removing other previews before installing this latest version.

      maui-check is still a thing, but your primary method of installing .NET MAUI now should be Visual Studio 2022 Preview 4.

      • Nicolò Carandini 0

        The new install doc has been published, thanks a lot.

  • Emmanuel Adebiyi 0

    Sad but way better than a buggy release

  • Mike Luczak 0

    When I install “Single-project MSIX Packaging Tools for VS 2022” and create a Maui app, I see a separate WinUI project and I don’t see the Windows folder under the Platforms folder with Android, iOS and MacCatalyst.

    Do I also need to download a second extension called “Windows App SDK extension for Visual Studio 2022”? Where is that located?

    • David OrtinauMicrosoft employee 0

      That’s the only extension you need.

      This sounds like you aren’t getting the latest .NET MAUI templates. If you had them previously installed by CLI / maui-check there could be a conflict. This is the source template and mirrors what you should see: https://github.com/dotnet/maui/tree/main/src/Templates/src/templates/maui-mobile

      Try to remove older .NET 6 previews and see if you get the new templates that way. Open an issue on dotnet/maui if you’re unable to detangle this and we can troubleshoot there.

      • Renee GA 0

        I got the same issue.

        The icon of .net MAUI template on my Visual Studio is also different from the icon in this blog.

        I fully removed visual studio 2022 and reinstalled the whole thing. This issue still happens.

        • Mike Luczak 0

          The first two Maui templates have a different icon and the third one (Library) has the correct icon.

          The third template is coming from C:\Program Files\dotnet\template-packs\Microsoft.Maui.Templates.6.0.100-rc.1.1608.nupkg.

          When I remove Microsoft.Maui.Templates.6.0.100-rc.1.1608.nupkg and restart VS 2022, I can still see the first two Maui templates with the different icon.

          • David OrtinauMicrosoft employee 0

            Thanks for the feedback. Sounds like you’ve hit a mismatch between what dotnet CLI (or maui-check) has installed and what comes with Visual Studio. We have ongoing work to address that on our side.

        • Pieter Nijs 0

          Hi Renee! Seems like you are getting the same issue I had.
          Seems like you should install the new MAUI templates manually. I blogged about it here.

          Hope this fixes your issue!

    • Mike Luczak 0

      There was a directory called .templateengine under my user directory. It had a folder named packages with the file Microsoft.Maui.Templates.6.0.100-preview.6.1003.nupkg.

      I removed the directory .templateengine and it fixed the problem.

      • Gil Zhang 0

        I also encountered the same problem and solved it perfectly with your method. Thank you very much.

  • Hong 0

    No SDK will ever be perfect. It is just a question of how manageable the imperfection is. I am still dealing with the UWP SDK issues, but they are manageable usually though the useless stack traces as a result of the .Net Native nightmare make debugging much harder than it should be. An Android native app can be improved rapidly during its initial buggy phase because its stack traces pinpoint culprits.
    One highly relevant question for developers who want to use an SDK to develop serious apps instead of having fun: what is the average turnaround time of bug fixing? Sometimes reverting to a previous version is not practical and a quick fix of an SDK is needed. App publishers cannon afford to watch the stream of app user complaints for an extended period of time. I have been enjoying Uno. One big advantage of Uno is the team can often fix a bug in one or two days, or even in hours if it is urgent. It gives me peace of mind.

    • David OrtinauMicrosoft employee 0

      There’s no simple answer to the turnaround time other than “it depends”. If the issue is high impact, critical, the problem is well understood, and the fix is clear, then then a fix can be done in a day. All PRs run through tests and generate publicly accessible artifacts that you can consume in your app. So if that fix works for you, you can be unblocked with that immediately.

      When a merged fix will be shipped depends upon the .NET servicing cadence.

      • Hong 0

        Thank you for the elucidation.

  • Andrew Mansell 0

    Really impressed with how this is proceeding. It’s always tough to push back a delivery, especially one as visible as this, but it’s far more important to get it right. I hope morale didn’t take too much of a hit. You guys are doing amazing work.

    I’m hoping that Linux is on the radar somewhere, even if it’s somewhere over the immediate horizon.

  • Shimmy Weitzhandler 0

    Sorry guys for ruining the party.
    I just learned about Uno Platform’s new version. I never liked MAUI’s object model and always preferred UWP, WinUI and Uno Platform, but reading this article makes me happy I gave trust in Uno Platform.

    • PandaSharp 0

      Same here, specially I don’t understand why develop a new cross platform framework and than use a separate project with winui XAML for windows, and main project with xamarin XAML for the rest of platforms. Also on the docs looks like the focus is everywhere else than Windows
      https://docs.microsoft.com/en-us/dotnet/maui/get-started/first-app?pivots=windows

    • Stevie White 0

      I’m going to have to agree with this one, UNO has been a breeze to work with, compared to MAUI/Xamarin. Xamarin itself felt like it was always Android first to me and everything else was an afterthought. I have been getting the same unfortunate impression with MAUI. 🙁

      I am also going to agree with PandaSharp.

      Alas, I hope there will be a more compelling reason to look at Maui next year when it gets closer to release, @David Ortinau. I did like some of the things I saw with it, but it still felt like it wasn’t as significant of a leap as what nventive had managed to achieve with UNO. Right now about the only thing with MAUI that I can see maybe being a reason to use it would be the Blazor use case.

  • Reyn Vlietstra 0

    Hi!
    It seems updating to Android 12 (API 31) caused archiving to produce .aab files.
    How do I set it to produce .apks ? Appcenter doesn’t handle .aab yet.
    Thanks!

    • Jérôme Laban 0

      Add this to your project:

      <AndroidPackageFormat>apk</AndroidPackageFormat>

      • Reyn Vlietstra 0

        Thanks! I added it to Project/PropertyGroup

  • Thilo Viereck 0

    Great decision to push MAUI back a bit to 2022! I followed MAUI closely on Github over the last weeks and its simply not ready (probably not even close to being ready). A few extra previews is what it needs and not a rushed and premature RC or GA release. Please take the time to get it right! And please continue to make architectural changes (host builder, layouts, handlers, desktop support, etc.) and remove legacy code until you are confident that MAUI is future-proof and works across all platforms and all scenarios.

    • saint4eva 0

      I support removing all legacy and compact features.

  • Martin 0

    I am curious about MAUI future. In the road map I would like to see drawn controls using Microsoft.Maui.Graphics. I know there is Microsoft.Maui.Graphics.Controls but not much effort is coming to this project right now.

    It would be super powerful for .NET developer to be able to use such controls across all OS (including linux and Blazor – not sure if SkiaSharp is supported on Blazor). Are there any plans to support this ??

    • David OrtinauMicrosoft employee 0

      For .NET 7 we are considering how we can invest into Graphics.Controls for this very purpose. I agree, it’ll be super powerful. Once plans are made, they will appear on https://themesof.net

Feedback usabilla icon