Yes, you read the title right. One single template to rule the possible design pattern options. To celebrate the 20th Birthday of .NET in style, happy to announce the release of a unified .NET MAUI App project template (with short name
mauiapp) published as both VS extension & CLI template package so as to benefit the users on both Windows and macOS. And this is also accessible from within Visual Studio IDE.
This template is now preloaded in the same .NET MAUI Project and Item Templates VS extension. Kindly update to the latest version. If not already installed, read this article on how to install this extension.
Update: Now, both the NuGet and VS Extension are updated to support the .NET MAUI RC1, the latest release as of Apr 2022. Newly added features are described here.
Also available to install from NuGet with the below command-line option:
dotnet new --install VijayAnand.MauiTemplates
To create a new project from CLI, run this command. Continue reading this article for more details on the options:
dotnet new mauiapp -n MyApp -dp Shell
Access the same project template from within Visual Studio IDE.
To locate this template, filter the
Project Type by
MAUI (3rd drop down). If you want to access it quickly, it can be pinned to the Recent project templates list on the left side pane as shown below.
This NuGet package comes preloaded with both Project and Item templates. In addition to the App project template, it also hosts a template for creating a .NET MAUI Class Library and Item templates for Page and View (in XAML and C#) and Shell (in XAML).
Both the App and Library project templates have options to optionally include the references for the officially supported Maui CommunityToolkit and Markup packages.
Following are the design pattern supported by the App project template while creating the project:
|Plain||App configured to work with a single, initial screen|
|Hierarchical||App configured to work in a hierarchical pattern using NavigationPage|
|Tab||App configured to work in a Tabbed fashion using TabbedPage|
|Shell||App configured to work with Routes using Shell page|
|Hybrid||App configured to work in a Hybrid fashion using BlazorWebView|
For the command line users, help is available within reach:
dotnet new mauiapp --help
From CLI, the following are the parameters that control these options (parameter values are case-insensitive):
--applicationId– The unique app (bundle) identifier of the Application (defaults to com.companyname.<project_name>)
--design-pattern– Takes any one of the values from the list (
Plainbeing the default)
--include-toolkit– Can be
--include-markup– Can be
While using the .NET CLI Templates within Visual Studio IDE, the last used values of the project options, like the above ones, are retained in the consecutive iteration rather than defaulting to their original values as defined by the developer. Since this is observed in both Microsoft templates and other 3rd party templates, have already reported this issue to the VS product team and is actively being followed up, until this is clarified/fixed, requesting the users to make use of this feature with a bit of caution.
The VS extension is made available here in VS Marketplace.
The NuGet hosted template is accessible from here.
If you come across any issues or have any ideas, feel free to raise an issue in the GitHub repository where it is actively worked upon.
You can also reach me on Twitter: @egvijayanand
Happy coding. Stay connected as we continue to learn and share the experiences from this exciting journey of being a .NET developer.