I have a project which includes 2 windows services. I create a ProjectInstaller to install these items, which works fine. But I have a question; given the code defined below, how does the project installer know which service to install for serviceInstaller1 and which for serviceInstaller2?
Is it simply based upon the ServiceName?
[RunInstaller(true)]
public partial class ProjectInstaller : System.Configuration.Install.Installer
{
private ServiceProcessInstaller process;
private ServiceInstaller serviceInstaller1;
private ServiceInstaller serviceInstaller2;
public ProjectInstaller()
{
InitializeComponent();
try
{
process = new ServiceProcessInstaller();
process.Account = ServiceAccount.LocalSystem;
serviceInstaller1 = new ServiceInstaller();
serviceInstaller1.ServiceName = "xxx";
serviceInstaller1.Description = "Does Something";
serviceInstaller1.StartType = ServiceStartMode.Automatic;
serviceInstaller2 = new ServiceInstaller();
serviceInstaller2.ServiceName = "yyy";
serviceInstaller2.Description = "Does something else";
serviceInstaller2.StartType = ServiceStartMode.Automatic;
Installers.Add(process);
Installers.Add(serviceInstaller1);
Installers.Add(serviceInstaller2);
}
catch (Exception ex)
{
throw new Exception("Failed", ex);
}
}
}