-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSvcInstaller.cs
More file actions
28 lines (24 loc) · 921 Bytes
/
SvcInstaller.cs
File metadata and controls
28 lines (24 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
namespace ServiceMonitor
{
[RunInstaller(true)]
public class SvcInstaller : Installer
{
public const string InternalServiceName = "Service Monitor";
public SvcInstaller()
{
var processInstaller = new ServiceProcessInstaller();
var serviceInstaller = new ServiceInstaller();
//set the privileges
processInstaller.Account = ServiceAccount.LocalSystem;
serviceInstaller.DisplayName = InternalServiceName;
serviceInstaller.StartType = ServiceStartMode.Manual;
//must be the same as what was set in Program's constructor
serviceInstaller.ServiceName = InternalServiceName;
this.Installers.Add(processInstaller);
this.Installers.Add(serviceInstaller);
}
}
}