Create a Windows Service Installer

Problem

You need to install your Windows service so that you can run or test it.

Solution

Create an installer class, and use the InstallUtil command-line utility.

Discussion

Because Windows services are controlled by the SCM, you must install them before you can run or debug them. To install a Windows service, you must create an installer class. Microsoft Visual Studio .NET can generate this installer class automatically. In the Solution Explorer, simply right-click your service code file, choose View Designer, and select the Add Installer link that displays in the Properties window (as shown in Figure 13-1).

The Add Installer link.

Figure 13-1. The ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.