I think the answer to this question is "it's not possible with Windows Installer standard capabilities". The alternative is a custom action, as usual, but it's not the path I suggest you to go.
Look, Windows Installer (and thus, WiX) is capable to operate with services in two main ways:
- install a new service (and unisntall, of course)
- configure an existing service
In the latter option, the service should be installed onto the system, i.e. should be present in the Services management console. And the MSI package will just start/stop it, etc.
When you specify a <ServiceInstall>
element in your WiX authoring, it is reflected in the record to the ServiceInstall MSI table. This table requires a Component as a foreign key. The way it detects the underlying EXE file of the service is the KeyPath
of that Component. And there's no way around it, as far as I can see.
So, I see two options for you in this case (both not what you would like or expect, I'm sure):
- install a service the usual way; forget there's an EXE file on the target PC and bring it with the MSI package
- make sure the service is installed before proceeding with your installation, if this is a critical requirement