VijayAnand.FormsTemplates 1.4.4

Prefix Reserved
This package has a SemVer 2.0.0 package version: 1.4.4+sha.6283f9f.
There is a newer version of this package available.
See the version list below for details.
dotnet new install VijayAnand.FormsTemplates::1.4.4                
This package contains a .NET Template Package you can call from the shell/command line.

CLI Project and Item Templates for developing Xamarin.Forms App that runs on iOS, Android, and Windows

Project template for Xamarin.Forms Class Library and is named as formsclasslib

Class library project template take the below optional parameters to override its target framework and to include the officially supported Xamarin.CommunityToolkit, Xamarin.CommunityToolkit.Markup, Xamarin.Essentials, CommunityToolkit.Mvvm (aka Microsoft MVVM Toolkit) or all NuGet packages:

  • -f | --framework - Default value is netstandard2.0
  • -it | --include-toolkit - Default value is false
  • -im | --include-markup - Default value is false
  • -ie | --include-essentials - Default value is false
  • -imt | --include-mvvm-toolkit - Default value is false

Note: The NuGet package version being added out-of-the-box are v2.0.x for the Xamarin Toolkit packages, v1.7.x for the Xamarin.Essentials package, and v8.1.0 for the MVVM Toolkit package.

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

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

dotnet new install VijayAnand.FormsTemplates

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

dotnet new update --check-only
dotnet new update

Use the below .NET CLI command to create the project, pages, and views out these templates:

Here, -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 / .cs, it will be added automatically) (Can also be specified as --name in the expanded form).

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

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

While working with .NET 7 or higher SDK, the namespace parameter in short notation needs to be passed as -p:na (i.e., it needs to be prefixed with -p:).

dotnet new formsclasslib -n MyApp.Core

Library target framework override:

dotnet new formsclasslib -n MyApp.Core -f netstandard2.1

Option to include NuGet packages:

dotnet new formsclasslib -n MyApp.UI -it -im -imt -ie

Page:

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

View:

dotnet new forms-view -n CardView -na MyApp.Views
dotnet new forms-view-cs -n ContactView -na MyApp.Views

Shell:

dotnet new forms-shell -n AppShell -na MyApp
dotnet new forms-shell-cs -n MobileShell -na MyApp

Resource Dictionary:

With C# code-behind file:

dotnet new forms-resdict -n DefaultTheme -na MyApp.Themes

Without C# code-behind file - Xaml only (Option can be specified as -xo or --xaml-only):

dotnet new forms-resdict -n DarkTheme -na MyApp.Themes -xo
  • .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
1.10.0 60 8/22/2024
1.9.0 58 6/24/2024
1.8.0 48 6/21/2024
1.7.0 1,624 1/16/2024
1.6.0 160 1/12/2024
1.5.0 1,247 11/25/2023
1.4.4 90 9/25/2023
1.4.3 119 3/16/2023
1.4.2 1,157 11/23/2022
1.4.1 397 11/4/2022
1.4.0 361 11/1/2022
1.3.1 551 5/31/2022
1.3.0 441 5/2/2022
1.2.0 480 4/20/2022
1.1.0 467 2/25/2022
1.0.0 451 2/3/2022

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

What's new in ver. 1.4.4:
-------------------------
Package versions bumped to pull the latest stable version.

v1.4.3:

1. Package versions have been made dynamic to pull the latest stable version.

2. Added a new item template for Shell definition in C#

dotnet new forms-shell-cs -n AppShell -na MyLib

v1.4.2:

Little housekeeping to improve the reliability of the templates.

v1.4.1

Xamarin.Forms version bumped to 5.0.0.2515 (SR12).

Option to the choose the library target framework - .NET Standard 2.0 / 2.1

v1.4.0:

Included an option to add reference Xamarin.Essentials NuGet package during Xamarin.Forms class library creation.

Added new item templates for Forms Page and View in C#.

v1.3.1:

Included the IsExternalInit class definition to make use of C# 9.0 features such as Records.