Announcing .NET MAUI Preview 6

David Ortinau

Today with .NET 6 Preview 6 we are shipping our latest progress on .NET Multi-platform App UI (MAUI). This release we are all-in on Visual Studio 2022 Preview 2. This also marks the first time we are shipping .NET MAUI as a workload installation. Several new capabilities are now available including gestures, modal pages, view clipping, native alerts, flex layout, and more. Single project also continues to be improved along with adopting the latest release of the Windows App SDK and Visual Studio extensions. Let’s take a deeper look.

Workload Installation

As part of .NET unification, we have introduced the concept of SDK workloads to enable specific developer scenarios on top of the .NET SDK you’ve installed. In preview 4 the underlying SDKs for Android, iOS, macOS, and Mac Catalyst were enabled, and now in preview 6 we are introducing the maui, maui-mobile, and maui-desktop workloads. The first will acquire and install all the required SDKs for building .NET MAUI applications. If you are only wanting to target mobile or desktop, you can choose those individually.

In the near future Visual Studio 2022 will include these with its installer. To use them today, jump into your favorite CLI. First, take a look at what you have installed already:

dotnet sdk check

output of sdk check, Announcing .NET MAUI Preview 6

This reports what has been installed via the .NET SDK installer itself. Now to see the additional workloads run:

dotnet workload list

output of workload list, Announcing .NET MAUI Preview 6

To then install .NET MAUI you can execute:

dotnet workload install maui

What about the maui-check dotnet tool? We will continue to update maui-check with each release as it does additional validation of your development environment to help you be successful: checking for OpenJDK, emulators, Xcode, Visual Studio versions, and more.

For more information about mobile and desktop workloads, read details here.

New .NET MAUI Capabilities

As you can see on our status report, we are very close to being completely green for enabling features in .NET MAUI. Let’s highlight a few of the newcomers.

Gestures

Gesture recognizers allow you to apply tap, pinch, pan, swipe, and drag-and-drop to any view instance. You can apply them easily in XAML:

<Grid>
    <Grid.GestureRecognizers>
        <TapGestureRecognizer NumberOfTapsRequired="2" Command="{Binding OnTileTapped}" />
    </Grid.GestureRecognizers>
    <!-- Grid content -->
</Grid>

gif of Weather app reacting to double tap, Announcing .NET MAUI Preview 6

In this example, when the weather widget tile is double-tapped, it simulates a refresh with a fade-out, fade-in animation.

Clipping

When you need to mask content you can now add shapes to the clipping region of a layout or view. The most common use for this is to make a circle image.

screen with circle image

<Image Source="face.png">
    <Image.Clip>
        <EllipseGeometry RadiusX="80"
                         RadiusY="80"
                         Center="80,80" />
    </Image.Clip>
</Image>

Native Alerts

Each platform has a native way of displaying alerts to users. These can be simple informational popups, simple input forms, and even action sheets with multiple options to guide a user. These are available from any Page in a .NET MAUI application.

await DisplayAlert ("Alert", "You have been alerted", "OK");

Image displayactionsheets

These are just a few of the controls and layouts updated in preview 6. For a complete list, check out the commit log on GitHub. A few sweeping changes for layout, borders, corners, and shadows will be arriving in preview 7.

Single Project and Windows

We’ve made a few updates to single project based on developer feedback and Windows support to adopt the latest features. Some of you have been following along with each release, and we love that! Thank you for providing your feedback and engaging with us on GitHub and Discord. So, what has changed in preview 6 that you’ll need to update in your existing solutions?

single project solution explorer, Announcing .NET MAUI Preview 6

Get Started Today

First thing’s first, install .NET 6 Preview 6. Now add the maui workload using the command above. Also make sure you have updated to the latest preview of Visual Studio 2022, or if you’re on macOS you can continue using CLI and your favorite code editor as we await the debut of Visual Studio for Mac 2022.

Ready? Create new app from the command line and then open the solution in Visual Studio 2022.

dotnet new maui -n HelloPreview6

In future versions of Visual Studio 2022 the .NET MAUI templates will appear in the File > New list. Until then, the CLI is your good friend.

Xcode 13 Beta 1 is the new minimum requirement for iOS and macOS. For additional information about getting started with .NET MAUI, refer to our documentation.

Feedback Welcome

Please let us know about your experiences using .NET MAUI Preview 6 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.

59 comments

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

  • Russell Gilbert 0

    It feels like Desktop is the junior partner with .Net MAU. All your examples seem to be for apps with a mobile design in mind. I’d really like to consider maui for a major desktop app (Windows/MacOS). Where can I go to engage with this new platform & understand how to build navigation for a big desktop app with multiple pages, docking, context menus etc. Am I too early in the game, is maui the wrong tool for this sort of app or have I just missed something? Think of something with the same form & scale as Visual Studio, although aimed at a different purpose.

    • Matthew Berg 0

      There are alternatives for multi-platform .NET desktop applications. One such project is Avalonia, which supports “WPF-style” applications for Windows, Linux, and MacOS.

      • Reed Harston 0

        Thanks for sharing, I’m going to take a look at that! I have the same issue Russell has. I want to work on a big multi-platform desktop application but all the support seems to be going to (those darn kids) mobile apps.

  • Reed Harston 0

    Hello David, I’d just like to clarify a few things about macOS support.

    In response to a comment on the blog announcing Preview 3 you said:

    Mac is in there. You can use Mac Catalyst which is what .NET MAUI uses by default, or you can use the Cocoa/AppKit Mac SDK that also ships with .NET 6.

    Then in response to a comment on the blog announcing Preview 4 you said:

    Hi Michael, it is native with Mac Catalyst. .NET 6 also supports AppKit with the Cocoa SDK.

    And in the sample MAUI code there is a MAUI example that has iOS, Android, and Catalyst in a single project, and then a separate macOS project using net6.0-macos.
    So, have I understood correctly that:

    1. You can use .NET 6 to create native AppKit applications for macOS (not MAUI)
    2. You can today create a single project application for iOS, Android, and MacCatalyst (essentially iOS), and someday WinUI, but not AppKit macOS applications (MAUI)

    So if I want to make an AppKit macOS application alongside Windows and mobile applications using .NET 6 I’d need two projects in a solution?

    Are there plans to support true native (AppKit) macOS applications in the single project from point 2?

    And to make sure we are 100% clear, MAUI is the idea of having a single project that supports iOS(and thus Catalyst)/Android/Windows? And AppKit macOS applications is part of net6.0 but not MAUI?

    You might note that I’m not treating Catalyst and AppKit applications as the same thing here in my questions, and that is because they aren’t, and they were never meant to be. In what I believe was your first blog post on MAUI you said:

    we see Apple going a different direction for macOS desktop development and we want to make sure we give you the very best experience.

    With all due respect, I think that is 100% false. Catalyst isn’t the future of macOS desktop development (SwiftUI is), and it isn’t the very best experience.

    Catalyst for Mac is meant as a tool to ease porting existing iPad applications to Mac, not for creating native Mac applications. Yes, Apple themselves have used it for some of their macOS applications, but those are mainly applications that didn’t exist for the Mac until they brought them over from iPad. Any other applications they have since changed from AppKit native to using Catalyst were simple applications that already existed for iPad, so it makes sense that they would consolidate their projects. Note that the vast majority of Mac applications still do not, and likely will never, use Catalyst.

    Catalyst isn’t meant for Mac applications, it is meant for cross-platform apps across the Apple ecosystem. So if I am using MAUI to get the cross-platform part of the equation, why limit us to the subset of Mac functionality available through Catalyst instead of providing full access to macOS? It is especially confusing to me because .NET 6 apparently will support macOS natively, so why not put that into MAUI?

    As well said in this comment on this blog post, Catalyst is, “A technology created by Apple to bring iOS apps into macOS and with restrictions, not exposing the full functionality of macOS.” As quoted in that comment, “Mac Catalyst doesn’t support accessing unavailable AppKit APIs.” Providing us macOS support via Catalyst then, by definition, is not the ‘very best experience’ because it doesn’t provide the complete UI framework.

    Now that Big Sur and M1 Macs exist, I believe we can see that Catalyst was really just laying the foundation for running iOS apps directly on the Mac, and I suspect that making it easy to port iPad apps was a happy side effect that they decided to release early as a ‘bonus feature’ while also giving them time to work out some bugs.

    The second half of the response from the Preview 4 blog I quoted earlier was a question:

    Are there features or controls in Mac Catalyst you are missing?

    I don’t have a specific example I can share right now because my application is still in development and I admittedly haven’t tried using Catalyst yet, but from my experience as a Mac user I can just tell when the app is a Catalyst app, and I don’t want that for my users. Nor do I want to feel limited in what I can do during development, so I use AppKit. I hope that, along with what I’ve said above, is enough to answer that question.

    Oh, and on a related note, the Supported Platforms page says macOS Big Sur is the minimum version for macOS, but iOS is supported back to iOS 10. Why is that? Catalyst support is older than Big Sur. Even if it turns out that Catalyst can provide everything I need for my application, only supporting the most recent version of macOS is already a deal breaker. I need to support several years worth of macOS.

  • anand mishra 0

    I am making a sample app in MAUI. How do you Navigate from one Page to another in MAUI.
    Seems App.Current.MainPage = new NavigationPage(new MainPage()); is not working. Please let me know if I am missing anything. Also Coudn’t found some controls like BusyIndicator in MAUI.

    Thanks

  • anand mishra 0

    Why App.Current.MainPage is not working in this release?

  • Sankar Balasubramanian 0

    Hi all,
    I am trying to run a sample MAUI app on the windows 10 desktop (HelloMaui.WinUI).
    I am using VS2022 preview(Community Edition) and my maui-check says “- Congratulations, everything looks great!”

    But facing the below exception while trying to run the application. (Any help is greatly appreciated)

    Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
    —> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
    at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName) in Microsoft.WinUI.dll:token 0x6000023+0x6e
    at Microsoft.UI.Xaml.Application._IApplicationStatics..ctor() in Microsoft.WinUI.dll:token 0x601388f+0x1c
    at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x60006c8+0x3e
    — End of inner exception stack trace —
    at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x60006c8+0x4e
    at System.Activator.CreateInstanceT in System.Private.CoreLib.dll:token 0x60009ed+0x0
    at WinRT.WeakLazy`1.get_Value() in Microsoft.WinUI.dll:token 0x6000019+0x20
    at Microsoft.UI.Xaml.Application._IApplicationStatics.get_Instance() in Microsoft.WinUI.dll:token 0x6013890+0x0
    at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback) in Microsoft.WinUI.dll:token 0x6009288+0x0
    at HelloMaui.WinUI.Program.Main(String[] args) in D:\MAUI\HelloMaui\HelloMaui.WinUI\obj\Debug\net6.0-windows10.0.19041\win-x64\Platforms\Windows\App.g.i.cs:line 26

    Thanks,
    Sankar

Feedback usabilla icon