I have an application that installs and starts a service during its usage.
I need to stop and uninstall this service as part of the uninstallation process (before actually uninstalling the file(s) in the MyApp folder as they will be in use by the running service)
I can stop and remove the service with the attached code.
How would I go about doing this?
With a custom action as part of my Setup project in Visual Studio can I trigger this pre uninstall?
Coding in VB.NET VS2008
Dim sc As New ServiceController()
sc.ServiceName = "svrctrl"
Dim svrctrl As New ProcessStartInfo
nssm.FileName = "C:\Program Files\MyApp\svrctrl.exe"
nssm.Arguments = "remove ServiceName"
nssm.CreateNoWindow = False
nssm.WindowStyle = ProcessWindowStyle.Hidden
nssm.WorkingDirectory = "C:\Program Files\MyApp\"