dotnet new Templates

The Particular dotnet new templates makes it easier to bootstrap a variety of common project and code related scenarios.

Installation

Install using the following command:

dotnet new --install ParticularTemplates::*

NServiceBus Endpoint Windows Service

This template makes it easier to create a Windows Service host for NServiceBus. The template follows the approach outlined in Windows Service Hosting.

The template can be used via the following.

dotnet new nsbwinservice --name MyWindowsService

This will create a new directory named MyWindowsService containing a Windows Service .csproj also named MyWindowsService.

To add to an existing solution:

dotnet new nsbwinservice --name MyWindowsService
dotnet sln add "MyWindowsService/MyWindowsService.csproj"

Options

dotnet new nsbwinservice --help

Target Framework

The target framework for the project.

-f|--framework

Default: net462

Supported: net47, net462, net452

ServiceControl Transport Adapter

This template makes it easier to create a Windows Service host for the ServiceControl Transport Adapter.

The template can be used via the following.

dotnet new scadapterwinservice --name MyAdapter

This will create a new directory named MyAdapter containing a windows service .csproj also named MyAdapter.

To add to an existing solution:

dotnet new scadapterwinservice --name MyAdapter
dotnet sln add "MyAdapter/MyAdapter.csproj"

Options

dotnet new scadapterwinservice --help

Target Framework

The target framework for the project.

-f|--framework

Default: net462

Supported: net47, net462, net452

dotnet new information

Creates a new project, configuration file, or solution based on the specified template. The dotnet new command provides a convenient way to initialize a valid .NET Core project. The command calls the template engine to create the artifacts on disk based on the specified template and options.

From dotnet-new documentation

Command execution

The dotnet command line operations can be executed from within any Console and the Visual Studio 2017 Developer Command Prompt.

Reference material

List installed templates

To list the currently installed templates run dotnet new with no parameters

Template install

Where [TemplatePackageName] is the name of the NuGet package that contains the template and [Version] is a NuGet version number.

dotnet new --install [TemplatePackageName]::[Version]

The wildcard * can be used to target the current released version.

dotnet new --install [TemplatePackageName]::*

Template Reset

To reset the installed templates to default list use:

dotnet new --debug:reinit

Install Location

The downloaded NuGet packages are cached on on disk at:

%USERPROFILE%\.templateengine\dotnetcli\vDOTNETVERSION\packages

With the list of installed templates listed in:

%USERPROFILE%\.templateengine\dotnetcli\vDOTNETVERSION\settings.json

Template uninstall

dotnet new --uninstall:[TemplatePackageName]

Samples

Related Articles


Last modified