Windows Service 'dotnet new' Template

Project Hosting
NuGet NServiceBus.Template.WindowsService (1-pre)
This page targets a pre-release version and is subject to change prior to the final release.

The NServiceBus dotnet new template makes it easier to create a Windows Service host for NServiceBus.

Installation

Install using the following:

dotnet new --install NServiceBus.Template.WindowsService::1.0.1-alpha*

Usage

The template can then be used via the following.

dotnet new nsbservice --name MyWindowsService

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

To add to an existing solution:

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

dotnet new information

dotnet new is still in preview. As such expect to suffer some friction due to bugs, lacking or incorrect documentation and the changing nature of the features and APIs.

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]::*

This command is currently in preview and not documented.

Install Location

The downloaded NuGets 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 uinstall

There is currently no method for uninstalling a specific template. The current hack recommended by Microsoft is to use reset the installed templates to default list using:

dotnet new --debug:reinit

Related Articles


Last modified