I have a windows service executable that I know is written in .NET which I need to install under a different service name to avoid a conflict. The install doesn\'t provide anyw
Add method to get CustomService name
private void RetrieveServiceName()
{
var serviceName = Context.Parameters["servicename"];
if (!string.IsNullOrEmpty(serviceName))
{
this.SomeService.ServiceName = serviceName;
this.SomeService.DisplayName = serviceName;
}
}
call on install and uninstall
public override void Install(System.Collections.IDictionary stateSaver)
{
RetrieveServiceName();
base.Install(stateSaver);
}
public override void Uninstall(System.Collections.IDictionary savedState)
{
RetrieveServiceName();
base.Uninstall(savedState);
}
installutil /servicename=”My Service [SysTest]” d:\pathToMyService\Service.exe
Source