public ProjectInstaller() { InitializeComponent(); // Sets the service process information. In this case just the account the service will run as var process = new ServiceProcessInstaller { Account = ServiceAccount.LocalSystem }; // // Set up the service information using data from the application settings // var serviceAdmin = new ServiceInstaller { StartType = Properties.Settings.Default.ServiceStartupType, DelayedAutoStart = Properties.Settings.Default.ServiceDelayedStart, ServiceName = Properties.Settings.Default.ServiceName, DisplayName = Properties.Settings.Default.ServiceDisplayName, Description = Properties.Settings.Default.ServiceDescription }; Installers.Add(process); Installers.Add(serviceAdmin); }
public ProjectInstaller() { // define and create the service installer serviceInstaller = new ServiceInstaller(); serviceInstaller.StartType = ServiceStartMode.Manual; serviceInstaller.ServiceName = serviceName; serviceInstaller.DisplayName = serviceDesc; Installers.Add(serviceInstaller); // define and create the process installer processInstaller = new ServiceProcessInstaller(); //#if RUNUNDERSYSTEM processInstaller.Account = ServiceAccount.LocalSystem; //#else // should prompt for user on install //processInstaller.Account = ServiceAccount.User; //processInstaller.Username = null; //processInstaller.Password = null; //#endif Installers.Add(processInstaller); InitializeComponent(); }