In the past I used the classes Installer, ServiceInstaller and ServiceProcessInstaller to make my app self-installable.
I just had to run InstallUtil.exe MyApp to install the app as a Windows Service.
But I can't find those classes on DotNet5.
They won't be ported? There are any other approach to replace them? Can anyone point me to some documentation on how to achieve this goal?
Here goes an example on how those classes were used in the past:
[RunInstaller(true)]
public class MyServiceInstaller : Installer
{
private string serviceName = "MyApp";
public MyServiceInstaller()
{
var processInstaller = new ServiceProcessInstaller();
var serviceInstaller = new ServiceInstaller();
processInstaller.Account = ServiceAccount.LocalSystem;
processInstaller.Username = null;
processInstaller.Password = null;
serviceInstaller.ServiceName = serviceName;
serviceInstaller.DisplayName = serviceName;
serviceInstaller.StartType = ServiceStartMode.Automatic;
this.Installers.Add(processInstaller);
this.Installers.Add(serviceInstaller);
this.Committed += new InstallEventHandler(MyServiceInstaller_Committed);
}
void MyServiceInstaller_Committed(object sender, InstallEventArgs e)
{
var controller = new ServiceController(serviceName);
controller.Start();
}
}