Categories
.NET .NET 10 .NET 11 .NET 9 .NET MAUI .NET MAUI 10 .NET MAUI 11 .NET MAUI 9 Android Aspire Avalonia Blazor C# CLI Desktop Developer Extensions F# General Getting Started Hybrid iOS Linux macOS Mobile NuGet Templates Tools Visual Studio VS Code VS2022 VS2026 WASM Web What's New What's New Windows Xamarin Xamarin.Forms XAML

What’s New in the All-in-One .NET MAUI Templates Pack v9.0 – Hello Avalonia

Support for .NET MAUI 11 Preview and the Avalonia backend for .NET MAUI brings Skia-based drawn controls, extending .NET MAUI to Linux and WebAssembly.

In line with the annual release cadence, the first public preview of .NET 11, an STS version, was released last month.

The second preview was released this month. It was then followed by the much-awaited preview release of the Avalonia backend for .NET MAUI, which is now available.

Simply put, .NET MAUI renders native controls from the underlying platform. Avalonia uses Skia to draw its controls across different platforms. This allows Avalonia to offer a similar look and feel everywhere.

With Avalonia, you can use the same .NET MAUI codebase to target even more platforms, including Linux and WebAssembly.

Basically, Avalonia offers a set of .NET MAUI Handlers designed to render Skia (Drawn) controls for .NET MAUI views.

Avalonia has announced plans to align its GA with the release of .NET MAUI 11 stable later this year.

Excited to share that preview support for both is now built into the All-in-One templates pack.

As the name suggests, it has a slew of features under the hood to work with .NET MAUI. To know more about all the features of this template pack, refer to the series of articles listed here.

Getting Started:

To try .NET MAUI 11 Preview, follow these steps:

  • First, install the latest .NET 11 Preview SDK. Download the installer from here.
    • .NET 11 Preview isn’t integrated into Visual Studio 2026 yet, so manual installation is the only choice for now.
  • Then install .NET MAUI Workload by executing the command below.
dotnet workload install maui
  • On Linux, only the .NET MAUI Android workload is supported for now:
    • Prefix sudo to elevate the user’s permission.
dotnet workload install maui-android
  • Post installation, verify the .NET version and whether the MAUI workload is listed with the commands below:
dotnet --version
dotnet workload list

Templates Support:

Both the CLI package and the VS Extension of the All-in-One Templates Pack have been updated to support creating .NET MAUI projects on .NET 11 Preview.

From CLI and for users on macOS / Linux:

Here’s the command to install the CLI templates pack (v9.0 or later).

dotnet new install VijayAnand.MauiTemplates

For users on VS2026:

  • To install as a VSIX, download and install from the Visual Studio Marketplace.
  • Alternatively, open Manage Extensions (shortcut: Alt+X+M) from within the Visual Studio IDE. Search with the maui keyword. Make sure the Online/Browse Tab is in focus. Then look for .NET MAUI Project and Item Templates. Click the Install button to start the process.
.NET MAUI Project and Item Templates - Visual Studio Extension
.NET MAUI Project and Item Templates – Visual Studio Extension

Visual Studio Project Options Dialog:

Visual Studio - Project Options Dialog - Option to add Avalonia backend for .NET MAUI
Visual Studio – Project Options Dialog – Option to add Avalonia backend for .NET MAUI

Support for .NET MAUI 11 Preview:

On the CLI, have introduced an additional option to the framework parameter – net11.0.

And in the IDE, .NET 11 (Preview) is added to the Framework dropdown to select.

Note: The default value for this framework parameter remains as net10.0 (the current stable channel), which means to create a project for .NET 11 (the preview channel), an explicit value of net11.0 is required, as shown below.

dotnet new mauiapp -o MyApp -f net11.0

Support for this .NET 11 framework parameter option is extended to the other two library projects as well.

dotnet new mauiclasslib -o MyLib -f net11.0
dotnet new sharedclasslib -o SharedLib -f net11.0

Note: Since .NET MAUI 8 is no longer supported, it has been removed. Apart from that, all other parameters and their options are supported as-is. To know more about the exhaustive features, take a look at these articles.

XAML C# Expresssion:

  • Introduced a new option in .NET MAUI 10+ for the XAML C# Expressions feature to make the binding process simpler.
  • This is still an experimental feature and requires .NET MAUI ver. 10.0.50 or higher to work.
  • Enable the MVVM to check out this feature in full action.
  • Will cover this topic in detail in a separate article.

-xce | --xaml-cs-expr – Default value is false.

dotnet new mauiapp -o MyApp -mvvm -xce -f net11.0

Support for Avalonia:

A new optional parameter has been introduced to support the Avalonia backend in .NET MAUI 11 Preview.

--avalonia – The default value is false.

To support additional targets, the target-platform parameter now takes two new options: Linux and Wasm.

The Desktop option now includes Linux as well.

In Avalonia, the TFM doesn’t include a specific platform identifier for desktop. It simply targets the base framework as it is (net11.0 for now). So, using Linux is more of a convenient convention for the Base TFM.

When --avalonia parameter is opted in, the Base framework becomes an executable by setting the OutputType to Exe. Otherwise, it stays as a library.

Note: All of these parameter changes are managed by the framework, so it only functions with .NET MAUI 11 Preview. Opting for it in earlier versions won’t have any impact.

dotnet new mauiapp -o MyApp -f net11.0 --avalonia

This will create a solution with two projects. One project is a regular .NET MAUI project with support for Avalonia bundled-in.

This will include the Avalonia NuGet package. Its builder method will be wired up in the startup. And project constants are defined so both Native and Drawn UI can run from the same codebase.

Another project is for a Web Assembly target. This project, in turn, references the earlier one.

To run the Web Assembly target, set the Browser project as the startup project.

When both Aspire and Avalonia are opted-in, the Drawn UI becomes the targeted project.

For both the class library projects, the option to include the Avalonia NuGet package is as follows:

-ia | --include-avalonia – The default value is false.

dotnet new mauiclasslib -o MyLib -ia -f net11.0
dotnet new sharedclasslib -o SharedLib -ia -f net11.0

The footer displaying the .NET MAUI version will show the text Skia when the app is rendered with Drawn controls. Refer to the screenshot below.

Known Limitations:

  • Hybrid apps (both BlazorWebView and HybridWebView) are not yet supported for the Drawn UI scenario.
    • Templates would still get generated, but won’t execute.
  • PushModal navigation is not working in Web Assembly.
  • Web Assembly target is not working with the Razor design pattern.
  • MAUI essential services are not yet supported. And they’ve started implementing it.

Screenshots:

.NET MAUI 11 Preview on Windows rendered with WinUI 3 Platform controls
.NET MAUI 11 Preview on Windows rendered with WinUI 3 Platform controls
.NET MAUI 11 Preview on Windows rendered with Avalonia Drawn controls
.NET MAUI 11 Preview on Windows rendered with Avalonia Drawn controls
.NET MAUI 11 Preview on Web Assembly rendered with Avalonia Drawn controls
.NET MAUI 11 Preview on Web Assembly rendered with Avalonia Drawn controls
.NET MAUI 11 Preview on Linux (WSL) rendered with Avalonia Drawn controls
.NET MAUI 11 Preview on Linux (WSL) rendered with Avalonia Drawn controls

Help and Support:

Documentation is available here. If you have any issues or features to suggest, please raise an issue with appropriate details here. Ideas are most welcome.

If you find these extensions useful, kindly support the work by adding your review to the VS Marketplace. Please also add a Star to the GitHub repository where it’s actively maintained. Also, share the word with your team and inner circle.

Much of my time is spent on adding new features to the templates pack. If you would like to recognize the work, kindly consider sponsoring on the GitHub Sponsors page. This will help sustain the momentum. You can also support by buying me a coffee on the Buy Me a Coffee page. Thanks in advance.

Happy coding. Stay connected as we continue to learn and share the experiences from this exciting journey of being a .NET developer.

Discover more from Developer Thoughts

Subscribe now to keep reading and get access to the full archive.

Continue reading