Closed WantStuff closed 5 years ago
I'd like to be able to a service start dependencies when creating a new service.
In case it helps, my work around for this is to add them independently using the below:
public static void SetDependencies(ServiceDefinition serviceDefinition, string[] dependencies) { if (dependencies == null || !dependencies.Any()) return; var dependenciesConcat = string.Join('\0', dependencies); var serviceHandle = new ServiceController(serviceDefinition.ServiceName).ServiceHandle; if (!Win32.ChangeServiceConfig( serviceHandle, Win32.SERVICE_NO_CHANGE, Win32.SERVICE_NO_CHANGE, Win32.SERVICE_NO_CHANGE, null, null, IntPtr.Zero, dependenciesConcat, null, null, null)) { throw new Win32Exception(); } }
Apologies, I have just seen this is already a feature request under #70
I'd like to be able to a service start dependencies when creating a new service.
In case it helps, my work around for this is to add them independently using the below: