Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Diagnostics;
- using System.Configuration;
- using System.ServiceProcess;
- using System.ComponentModel;
- using System.Configuration.Install;
- namespace WindowsService
- {
- //Allows the installer to run
- [RunInstaller(true)]
- public class WindowsServiceInstaller : Installer
- {
- //Constructor / Put Initialization code here
- public WindowsServiceInstaller()
- {
- //Sets up the connection/control variables
- ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
- ServiceInstaller serviceInstaller = new ServiceInstaller();
- //Service Account
- serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
- serviceProcessInstaller.Username = null;
- serviceProcessInstaller.Password = null;
- //Service details
- serviceInstaller.DisplayName = "WinService";
- serviceInstaller.StartType = ServiceStartMode.Manual;
- serviceInstaller.DisplayName = "Windows Service"; //Keep the same as string in WindowsService class
- //Implements installer
- this.Installers.Add(serviceProcessInstaller);
- this.Installers.Add(serviceInstaller);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement