This documentation is archived and is not being maintained.

ServiceInstaller Constructor

Initializes a new instance of the ServiceInstaller class.

Namespace: System.ServiceProcess
Assembly: System.ServiceProcess (in system.serviceprocess.dll)

public ServiceInstaller ()
public ServiceInstaller ()
public function ServiceInstaller ()

To install a service, create a project installer class that inherits from the Installer class, and set the RunInstallerAttribute attribute on the class to true. Within your project, create one ServiceProcessInstaller instance per service application, and one ServiceInstaller instance for each service in the application. Within your project installer class constructor, set the installation properties for the service using the ServiceProcessInstaller and ServiceInstaller instances, and add the instances to the Installers collection.

The ServiceInstaller constructor automatically generates an event log source whose Log property is set to the computer's Application log, and an EventLogInstaller. When you set the ServiceName of the ServiceInstaller, which should be identical to the ServiceBase.ServiceName of the service, the Source property of the event log is automatically set to the same value. The source is deleted automatically in the case of an installation failure.

The ServiceInstaller constructor sets the StartType property to ServiceStartMode.Manual to specify that a user start the service. You can reset the property to ServiceStartMode.Automatic to specify that the service start when the computer reboots.

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: