Exemplo n.º 1
0
        public WindowsServiceManager()
        {
            var processInstaller = new ServiceProcessInstaller { Account = ServiceAccount.LocalSystem };
            var serviceInstaller = new ServiceInstaller { StartType = ServiceStartMode.Automatic, ServiceName = GlobalConstants.ServiceName };

            while(Installers.Count > 0)
            {
                Installers.RemoveAt(0);
            }

            Installers.AddRange(serviceInstaller.Installers);

            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }