VijayAnand.MauiTemplates 1.7.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet new install VijayAnand.MauiTemplates::1.7.1
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:

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

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.

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

.NET MAUI Class Library:

dotnet new mauiclasslib -n MyApp.Core

Option to include NuGet packages:

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

Shared Class Library:

dotnet new sharedclasslib -n MyApp.UI

Option to include NuGet packages:

dotnet new sharedclasslib -n MyApp.UI -ife -ift -ifm -imt -imm -inmt

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
5.2.1 71 4/17/2024
5.2.0 54 4/10/2024
5.1.0 372 3/12/2024
5.0.1 704 2/18/2024
5.0.0 162 2/14/2024
4.9.0 192 2/8/2024
4.8.1 582 1/18/2024
4.8.0 127 1/15/2024
4.7.0 345 1/4/2024
4.6.0 1,035 11/30/2023
4.5.0 211 11/24/2023
4.4.0 332 11/14/2023
4.4.0-preview.5 149 11/10/2023
4.4.0-preview.4 78 11/9/2023
4.4.0-preview.3 282 10/30/2023
4.4.0-preview.2 354 10/18/2023
4.4.0-preview.1 78 10/18/2023
4.3.0 261 10/13/2023
4.2.2 225 10/7/2023
4.2.1 156 10/4/2023
4.2.0 94 10/4/2023
4.1.1 114 9/26/2023
4.1.0 149 9/13/2023
4.0.1 148 8/27/2023
4.0.0 118 8/17/2023
3.6.0 123 8/10/2023
3.5.0 155 7/14/2023
3.4.1 167 6/14/2023
3.4.0 99 6/13/2023
3.3.2 147 5/18/2023
3.3.1 98 5/17/2023
3.3.0 102 5/16/2023
3.2.4 170 4/20/2023
3.2.3 120 4/17/2023
3.2.2 109 4/14/2023
3.2.1 109 4/11/2023
3.2.0 111 4/5/2023
3.2.0-preview.6 97 4/3/2023
3.2.0-preview.5 96 4/2/2023
3.2.0-preview.4 93 3/30/2023
3.2.0-preview.3 101 3/27/2023
3.2.0-preview.2 99 3/25/2023
3.2.0-preview.1 95 3/24/2023
3.1.0 156 3/23/2023
3.1.0-preview.9 93 3/20/2023
3.1.0-preview.8 98 3/18/2023
3.1.0-preview.7 99 3/15/2023
3.1.0-preview.6 94 3/14/2023
3.1.0-preview.5 96 3/11/2023
3.1.0-preview.4 92 3/9/2023
3.1.0-preview.3 99 3/7/2023
3.1.0-preview.2 96 3/4/2023
3.1.0-preview.1 97 3/3/2023
3.0.2 177 3/6/2023
3.0.1 120 3/3/2023
3.0.0 143 2/22/2023
2.4.1 126 2/17/2023
2.4.0 138 2/6/2023
2.3.1 161 1/27/2023
2.3.0 130 1/25/2023
2.2.0 165 12/19/2022
2.1.3 1,007 11/23/2022
2.1.2 332 11/18/2022
2.1.1 317 11/10/2022
2.1.0 306 11/8/2022
2.0.3 362 10/26/2022
2.0.2 363 10/25/2022
2.0.1 406 10/21/2022
2.0.0 433 10/4/2022
1.7.3 552 8/5/2022
1.7.2 582 6/17/2022
1.7.1 448 6/7/2022
1.7.0 495 5/24/2022
1.6.0 432 5/23/2022
1.5.0 486 5/12/2022
1.4.1 529 4/28/2022
1.4.0 416 4/27/2022
1.3.1 478 4/19/2022
1.3.0 473 4/14/2022
1.2.0 494 3/29/2022
1.1.3 555 2/19/2022
1.1.2 425 2/18/2022
1.1.1 448 2/16/2022
1.1.0 403 2/16/2022
1.0.8 429 2/14/2022
1.0.7 420 2/14/2022
1.0.6 452 2/1/2022
1.0.5 416 1/31/2022
1.0.4 369 11/9/2021
1.0.3 375 10/15/2021
1.0.2 982 8/16/2021
1.0.1 409 8/13/2021
1.0.0 342 8/12/2021

What's new in ver. 1.7.1:
-------------------------
Introduced a new parameter to include all supported packages in the Shared Class Library template.

-asp | --all-supported-packages

Which will add reference to all 6 supported NuGet packages.

Included IsExternalInit type definition to support C# Records while compiling for Xamarin.Forms

Templates have been updated to .NET MAUI GA, stable release version.

Breaking change: To make things easier, All-in-One and Class Library templates parameters for various package inclusion have been updated to Boolean parameter type.

Also check out the newly included project template for creating a Shared Class Library that produces assemblies targeting Xamarin.Forms and .NET MAUI.

With C# Markup, Global usings and Compiler directives, both Xamarin.Forms and .NET MAUI can be targeted from single project.

dotnet new sharedclasslib --name MyApp.UI

In which:

*.forms.cs source files will be specific to Xamarin.Forms
*.maui.cs source files will be specific to .NET MAUI
*.shared.cs / *.logic.cs will be common to both Xamarin.Forms and .NET MAUI

Refer to VijayAnand.Toolkit.Markup NuGet package source made available here https://github.com/egvijayanand/dotnet-maui-toolkit for a sample.

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