You need to open the Service.cs file in the designer, right click it and choose the menu-option “Add Installer”.
It won’t install right out of the box… you need to create the installer class first.
Some reference on service installer:
How to: Add Installers to Your Service Application
Quite old… but this is what I am talking about:
Windows Services in C#: Adding the Installer (part 3)
By doing this, a ProjectInstaller.cs will be automaticaly created. Then you can double click this, enter the designer, and configure the components:
-
serviceInstaller1has the properties of the service itself:Description,DisplayName,ServiceNameandStartTypeare the most important. -
serviceProcessInstaller1has this important property:Accountthat is the account in which the service will run.
For example:
this.serviceProcessInstaller1.Account = ServiceAccount.LocalSystem;