As far as I know neither MSI nor WiX offer functionality for controlling external services (not the ones being installed). Though I can be wrong.
However Wix# allows easy control of any OS component including services. Have a look at WinService_InstallUtil sample. You will need to schedule an elevated custom action and restart your service by either using .NET service API or with sc.exe. Wix#tasks already have sc.exe wrapped:
This can be even easier with Managed Setup:
As for launch condition I advise you to have a look at Launch Condition sample. In your case that actual condition would be the presence of service exe, or another product being installed and product code being present in registry. I personally prefer to use C# to check the service presence from the event handler and abort the setup if needed.
However Wix# allows easy control of any OS component including services. Have a look at WinService_InstallUtil sample. You will need to schedule an elevated custom action and restart your service by either using .NET service API or with sc.exe. Wix#tasks already have sc.exe wrapped:
var project = new Project("My Product", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"..\SimpleService\MyApp.exe")), new ElevatedManagedAction(CustomActions.RestartService, Return.check, ... [CustomAction] publicstatic ActionResult RestartService(Session session) { return session.HandleErrors(() => { Tasks.StopService("WixSharp.SimpleService", throwOnError:false); Tasks.StartService("WixSharp.SimpleService", throwOnError:false); }); }
project.AfterInstall += project_AfterInstall; ... staticvoid project_AfterInstall(SetupEventArgs e) { Tasks.StopService("WixSharp.SimpleService", throwOnError:false); Tasks.StartService("WixSharp.SimpleService", throwOnError:false); }