Install Windows Service created in Visual Studio

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:

  • serviceInstaller1 has the properties of the service itself: Description, DisplayName, ServiceName and StartType are the most important.

  • serviceProcessInstaller1 has this important property: Account that is the account in which the service will run.

For example:

this.serviceProcessInstaller1.Account = ServiceAccount.LocalSystem;

Leave a Comment