VijayAnand.MauiTemplates 2.0.3

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet new install VijayAnand.MauiTemplates::2.0.3                
This package contains a .NET Template Package you can call from the shell/command line.

Project and Item Templates for developing .NET MAUI App that runs on iOS, Android, macOS, and Windows

  • All-in-One project template for .NET MAUI App and is named as mauiapp
  • .NET MAUI Class Library project template and is named as mauiclasslib
  • Shared Class Library (Xamarin.Forms and .NET MAUI) project template and is named as sharedclasslib

Item templates for the following:

Item Template Name
ContentPage (XAML) maui-page
ContentPage (C#) maui-page-cs
ContentView (XAML) maui-view
ContentView (C#) maui-view-cs
Shell (XAML) maui-shell
ResourceDictionary (XAML) maui-resdict

All of these templates currently target .NET MAUI GA, stable release as of May 2022.

To install the template NuGet package, use the below .NET CLI command:

dotnet new --install VijayAnand.MauiTemplates

If you've already installed this package, then it can be updated to the latest version with the below command:

dotnet new --update-check
dotnet new --update-apply

Use the below .NET CLI command to create the All-in-One .NET MAUI App, library project, pages, and views out these templates:

Note: Parameter values are case-insensitive.

Both .NET MAUI App and Class Library templates take the below optional Boolean parameters to include the officially supported CommunityToolkit NuGet packages:

And now conditional compilation can be configured so that platform source files can be defined anywhere in the project provided they follow a naming convention as mentioned below.

This will allow maintaining related source files in the same place, especially MAUI Handlers.

  • *.Standard.cs - Files targeting the BCL
  • *.Android.cs - Files specific to Android
  • *.iOS.cs - Files shared with both iOS and MacCatalyst
  • *.MacCatalyst.cs - Files specific to MacCatalyst
  • *.Tizen.cs - Files specific to Tizen
  • *.Windows.cs - Files specific to Windows

Specifying the parameter name, either in short or full notation, implies that it is defined.

  • -it | --include-toolkit - Default is false
  • -im | --include-markup - Default is false
  • -imt | --include-mvvm-toolkit - Default is false
  • -cc | --conditional-compilation - Default is false

All-in-One .NET MAUI App project takes one additional parameter to define the application design pattern:

  • -dp | --design-pattern

Can take any one of the following values, with default value set to Plain:

Parameter Value Description
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.

Shared Class Library template take the below optional Boolean parameters to include the officially supported NuGet packages:

Specifying the parameter name, either in short or full notation, implies that it is defined.

Single parameter to include all the supported NuGet packages:

  • -asp | --all-supported-packages - Default is false

Specific to Xamarin.Forms:

  • -ife | --include-forms-essentials - Default is false
  • -ift | --include-forms-toolkit - Default is false
  • -ifm | --include-forms-markup - Default is false

Specific to .NET MAUI:

  • -imt | --include-maui-toolkit - Default is false
  • -imm | --include-maui-markup - Default is false

Common to both:

  • -inmt | --include-mvvm-toolkit - Default is false

For more details: run this command in the terminal (use -h to save some keystrokes):

dotnet new mauiapp --help
dotnet new mauiclasslib --help
dotnet new sharedclasslib --help

.NET MAUI App:

dotnet new mauiapp -n MyApp -dp Hybrid

Option to include NuGet packages:

dotnet new mauiapp -n MyApp -dp Shell -it -im -imt

Option to configure conditional compilation:

dotnet new mauiapp -n MyApp -dp Shell -cc

.NET MAUI Class Library:

dotnet new mauiclasslib -n MyApp.Core

Option to include NuGet packages:

dotnet new mauiclasslib -n MyApp.Core -it -im -imt

Option to configure conditional compilation:

dotnet new mauiclasslib -n MyApp.Core -cc

Shared Class Library:

dotnet new sharedclasslib -n MyApp.UI

Option to include all supported NuGet packages:

dotnet new sharedclasslib -n MyApp.UI -asp

Pages:

dotnet new maui-page -n LoginPage -na MyApp.Views
dotnet new maui-page-cs -n HomePage -na MyApp.Views

Views:

dotnet new maui-view -n CardView -na MyApp.Views
dotnet new maui-view-cs -n OrderView -na MyApp.Views

Shell:

dotnet new maui-shell -n AppShell -na MyApp

Resource Dictionary:

With code-behind C# file:

dotnet new maui-resdict -n DarkTheme -na MyApp

Without code-behind C# file (Here -ncb | --no-code-behind denotes the option to exclude the C# file):

dotnet new maui-resdict -n DarkTheme -na MyApp -ncb

In all the examples, -n denotes the name of the project/page/view that is to be created (for pages/views, don't need to suffix it with .xaml, it will be added automatically) (Can also be specified as --name).

Note: If name parameter input is not provided, the .NET CLI template engine will take the current folder name in the context as its name (default behavior).

And -na denotes the namespace under which the file is to be created (Can also be specified as --namespace).

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.1.0 158 11/29/2024
6.0.0 74 11/19/2024
5.15.0 116 10/23/2024
5.14.0 81 10/10/2024
5.13.0 126 9/13/2024
5.12.1 115 8/15/2024
5.12.0 71 8/14/2024
5.11.0 67 8/5/2024
5.10.1 57 8/1/2024
5.10.0 75 7/26/2024
5.9.0 98 7/9/2024
5.8.0 70 7/5/2024
5.7.0 74 6/28/2024
5.6.2 87 6/13/2024
5.6.1 61 6/12/2024
5.6.0 62 6/11/2024
5.5.0 75 6/6/2024
5.4.0 242 5/22/2024
5.3.0 261 5/14/2024
5.2.1 141 4/17/2024
5.2.0 88 4/10/2024
5.1.0 408 3/12/2024
5.0.1 738 2/18/2024
5.0.0 198 2/14/2024
4.9.0 229 2/8/2024
4.8.1 614 1/18/2024
4.8.0 159 1/15/2024
4.7.0 378 1/4/2024
4.6.0 1,068 11/30/2023
4.5.0 241 11/24/2023
4.4.0 373 11/14/2023
4.4.0-preview.5 188 11/10/2023
4.4.0-preview.4 107 11/9/2023
4.4.0-preview.3 313 10/30/2023
4.4.0-preview.2 382 10/18/2023
4.4.0-preview.1 111 10/18/2023
4.3.0 295 10/13/2023
4.2.2 258 10/7/2023
4.2.1 188 10/4/2023
4.2.0 126 10/4/2023
4.1.1 152 9/26/2023
4.1.0 179 9/13/2023
4.0.1 178 8/27/2023
4.0.0 147 8/17/2023
3.6.0 153 8/10/2023
3.5.0 187 7/14/2023
3.4.1 199 6/14/2023
3.4.0 129 6/13/2023
3.3.2 178 5/18/2023
3.3.1 129 5/17/2023
3.3.0 133 5/16/2023
3.2.4 203 4/20/2023
3.2.3 151 4/17/2023
3.2.2 141 4/14/2023
3.2.1 142 4/11/2023
3.2.0 143 4/5/2023
3.2.0-preview.6 125 4/3/2023
3.2.0-preview.5 123 4/2/2023
3.2.0-preview.4 122 3/30/2023
3.2.0-preview.3 129 3/27/2023
3.2.0-preview.2 128 3/25/2023
3.2.0-preview.1 122 3/24/2023
3.1.0 188 3/23/2023
3.1.0-preview.9 120 3/20/2023
3.1.0-preview.8 127 3/18/2023
3.1.0-preview.7 126 3/15/2023
3.1.0-preview.6 121 3/14/2023
3.1.0-preview.5 123 3/11/2023
3.1.0-preview.4 118 3/9/2023
3.1.0-preview.3 126 3/7/2023
3.1.0-preview.2 122 3/4/2023
3.1.0-preview.1 123 3/3/2023
3.0.2 208 3/6/2023
3.0.1 149 3/3/2023
3.0.0 174 2/22/2023
2.4.1 158 2/17/2023
2.4.0 171 2/6/2023
2.3.1 193 1/27/2023
2.3.0 165 1/25/2023
2.2.0 197 12/19/2022
2.1.3 1,176 11/23/2022
2.1.2 376 11/18/2022
2.1.1 346 11/10/2022
2.1.0 341 11/8/2022
2.0.3 407 10/26/2022
2.0.2 406 10/25/2022
2.0.1 448 10/21/2022
2.0.0 473 10/4/2022
1.7.3 591 8/5/2022
1.7.2 624 6/17/2022
1.7.1 488 6/7/2022
1.7.0 526 5/24/2022
1.6.0 472 5/23/2022
1.5.0 529 5/12/2022
1.4.1 572 4/28/2022
1.4.0 465 4/27/2022
1.3.1 522 4/19/2022
1.3.0 513 4/14/2022
1.2.0 530 3/29/2022
1.1.3 592 2/19/2022
1.1.2 464 2/18/2022
1.1.1 475 2/16/2022
1.1.0 442 2/16/2022
1.0.8 464 2/14/2022
1.0.7 454 2/14/2022
1.0.6 476 2/1/2022
1.0.5 456 1/31/2022
1.0.4 403 11/9/2021
1.0.3 414 10/15/2021
1.0.2 1,011 8/16/2021
1.0.1 443 8/13/2021
1.0.0 382 8/12/2021

What's new in ver. 2.0.3:
-------------------------
1. A parameter named target-platform has been introduced that takes any one of the following values (with All being the default value).

All - Targets all possible .NET MAUI supported platforms.
Android - Targets Android platform.
iOS - Targets iOS platform.
macOS - Targets macOS platform via Mac Catalyst.
Windows - Targets Windows platform.
Tizen - Targets Tizen platform.
Mobile - Targets Android and iOS platforms.
Desktop - Targets Windows and macOS platforms.
Apple - Targets iOS and macOS platforms.

dotnet new mauiapp --target-platform Mobile

dotnet new mauiapp -tp Android

v2.0.2:

Android targetSdkVersion set in accordance with the framework version selected.

.NET 7 - targetSdkVersion 33

.NET 6 - targetSdkVersion 31

v2.0.1:

Templates have been updated to support .NET MAUI on .NET 7 (RC2 - Preview release).

v2.0.0:

1. A parameter named framework has been introduced that takes either net6.0 or net7.0 as its options (with net7.0 being the default value).

dotnet new mauiapp --framework net6.0

dotnet new mauiapp -f net7.0

2. For App project targeting .NET 7, option to add and configure Maui Maps NuGet package.

Note: If project target .NET 6, selecting the Maps option will NOT have any impact.

Join me on Developer Thoughts (https://egvijayanand.in/), an exclusive blog for articles on .NET MAUI and Blazor.