2

I have a .Net 5 console application that I am trying to run as a Windows service. I have followed all of the articles online on how to do this and have it completed successfully (ie: using BackgroundService). The question is, I want to have an MSI installer to deploy this and all of the articles I have read about creating a service in .Net 5 instruct me to install the service manually using a command prompt or power shell and issuing the "sc" command.

Back before .Net 5, I could use the built in Visual Studio Installer extension and simply create an MSI that would deploy and install my service. I can't seem to make that work for .Net 5.

Is it still possible to use the built in Installer extension to deploy and install my .Net 5 BackgroundService?

Thanks!

Michael Bedford
  • 1,742
  • 20
  • 48
  • Is this .NET core or .NET? Did you work in Sydney some years ago? – Stein Åsmul Nov 04 '21 at 21:24
  • Sorry, didn't clarify, it is just a .NET 5 console application as a background service. No, I didn't work in Sydney. Did you know somebody with my name that did? – Michael Bedford Nov 05 '21 at 00:41
  • Yes, I did I think. Many years ago. Does this service of yours respond to service commands such as start, stop, pause, restart, etc...? It needs to for MSI to be able to install it using built-in constructs. It looks like it should do so. WiX can definitely install services, the Visual Studio Installer Projects do strange stuff for services. Just go with WiX - find links for quick start below. [There are also other tools](https://stackoverflow.com/a/50229840/129130). – Stein Åsmul Nov 05 '21 at 02:17

1 Answers1

1

Installing Services: There are many ways to install services, you should use an MSI package and the built-in mechanisms there to install and start the service and stop and update it during upgrades.

Various ways to install services (with links to samples on how to install services using MSI).

Learning WiX: Please see the WiX section here - the links should get you started. Direct link to the main WiX link list.


Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164