3

I Have a Worker Service written in c# that needs to be installed as a Windows Service (configured by calling the UseWindowsService method).

This guide specifies how to create an installer for a .NET 6 application, but this installer only copies the app's files.

How can I install the service contained in the executable?

mainvoid
  • 347
  • 1
  • 4
  • 17

2 Answers2

1

You can use sc create command in order to register service. Like this:

sc.exe create NewService binpath= c:\windows\system32\NewServ.exe

P.S. pay attention, there is mandatory space after binpath=

Uriil
  • 11,948
  • 11
  • 47
  • 68
1

There's a lot more steps to make it a service you can create. See https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service

I was missing some of the nuget packages and other hand edits to the csproj file.

Denise Skidmore
  • 2,286
  • 22
  • 51