CSharp examples for System:Windows
Create a Windows Service Installer
using System.Configuration.Install; using System.ServiceProcess; using System.ComponentModel; [RunInstaller(true)] class MainClass { public static void Main() { ServiceProcessInstaller ServiceExampleProcess = new ServiceProcessInstaller(); ServiceExampleProcess.Account = ServiceAccount.LocalSystem; ServiceInstaller ServiceExampleInstaller = new ServiceInstaller(); ServiceExampleInstaller.DisplayName = "Service Example"; ServiceExampleInstaller.ServiceName = "book2s.com Service"; ServiceExampleInstaller.StartType = ServiceStartMode.Automatic; Installers.Add(ServiceExampleInstaller); Installers.Add(ServiceExampleProcess); } }