Categories
.NET MAUI Blazor Desktop Developer Mobile Templates Visual Studio VS Code Xamarin

All-in-One .NET MAUI App Project Template

Celebrate .NET’s 20th Birthday in style with a unified .NET MAUI App project template.

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.

All-in-One .NET MAUI App Project Template
All-in-One .NET MAUI App Project Template

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.

All-in-One .NET MAUI App Project Template – Pinned for Quick Access

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:

Design PatternDescription
PlainApp configured to work with a single, initial screen
HierarchicalApp configured to work in a hierarchical pattern using NavigationPage
TabApp configured to work in a Tabbed fashion using TabbedPage
ShellApp configured to work with Routes using Shell page
HybridApp configured to work in a Hybrid fashion using BlazorWebView
All-in-One .NET MAUI App Project – Design Pattern Details
All in One - .NET MAUI App project template - Design Pattern
All-in-One .NET MAUI App Project Creation Wizard – Design Pattern
All-in-One .NET MAUI App Project Template - Design Pattern - Expanded
All-in-One .NET MAUI App Project Creation Wizard – Design Pattern – Expanded

For the command line users, help is available within reach:

dotnet new mauiapp --help
All-in-One .NET MAUI App Project Options – CLI Help

CLI Options:

From CLI, the following are the parameters that control these options (parameter values are case-insensitive):

  • -ap | --applicationId – The unique app (bundle) identifier of the Application (defaults to com.companyname.<project_name>)
  • -dp | --design-pattern – Takes any one of the values from the list (Plain being the default)
  • -it | --include-toolkit – Can be Yes or No (default value)
  • -im | --include-markup – Can be Yes or No (default value)

Known Limitation:

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.

By Vijay Anand E G

A software professional with over a decade long industry experience in developing products that spans across desktop, mobile, and web.

5 replies on “All-in-One .NET MAUI App Project Template”

This looks really cool! If there’s just one thing I would add, it’s the ability to also include a Blazor Server or WebAssembly (with optional ASP.NET hosting) app and a Razor Class Library for sharing web UI between the Blazor app and a MAUI Blazor hybrid app.

Like

Comments are closed.