dotnet new Templates

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

The dotnet new command creates a new project, configuration file, or solution based on the specified template. The command provides a convenient way to initialize a valid SDK-style project. The command calls the template engine to create the artifacts on disk based on the specified template and options. More information is available in the dotnet-new documentation.

Installation

Install using the following command:

dotnet new --install ParticularTemplates

NServiceBus Windows Service

This template makes it easier to create a Windows Service host for an NServiceBus endpoint.

The template can be used via the following command:

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: netcoreapp2.1, net472, net471, net47, net462, net461, net46, net452

When installing an endpoint created from this template as a service, the --run-as-service parameter must be set on the command line. See Windows Service Installation for details.

ServiceControl Transport Adapter Windows Service

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

The template can be used via the following command:

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: netcoreapp2.1, net472, net471, net47, net462, net461, net46, net452

When installing an endpoint created from this template as a service, the --run-as-service parameter must be set on the command line. See Windows Service Installation for details.

NServiceBus Docker Container

This template makes it easier to create a Docker container host for an NServiceBus endpoint. The template follows the approach outlined in Docker Container Host.

The template can be used via the following command:

dotnet new nsbdockercontainer --name MyEndpoint

This will create a new directory named MyEndpoint containing a .csproj also named MyEndpoint.

To add to an existing solution:

dotnet new nsbdockercontainer --name MyEndpoint
dotnet sln add "MyEndpoint/MyEndpoint.csproj"

To build the Docker image, open the command line, change to the directory containing the endpoint's .csproj, and run the following command:

docker build -f Dockerfile -t MyEndpoint ./..

Samples

Related Articles


Last modified