Take the 2-minute tour ×

I'm trying to write MSI installer/uninstaller for my software using WiX. The software comes with a local service and a related user-mode process that always run together, i.e. the user-mode process is closed automatically by my service when the service is stopped. (Otherwise if the user-mode process is terminated by itself the service will attempt to restart it.)

So for the uninstallation I came up with the following mark-up:

<Component Id="idCmp_MySrvc" 

  <File Id="idFile_srvc.exe" 
   KeyPath="yes" />

  <File Id="idFile_usermodule.exe" 
   KeyPath="yes" />

  <ServiceControl Id="idMySrvc" 
                Stop="uninstall" />

The idea was that when the service is stopped it will close my usermodule.exe process.

But there're three issues/questions that come to mind:

1: When I compile this, it gives me the following error:

error CNDL0042: The Component element has multiple key paths set. The key path may only be set to 'yes' in extension elements that support it or one of the following locations: Component/@KeyPath, File/@KeyPath, RegistryValue/@KeyPath, or ODBCDataSource/@KeyPath.

2: How to ensure that the MSI doesn't bother with usermodule.exe process during uninstallation checks?

3: Do I need to add anything specific to my service and/or user mode process to make it comply with uninstallation procedure?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

General answer: in order to install / uninstall Windows service by MSI package made with WiX, you should only leverage ServiceInstall and ServiceControl elements, as Christopher mentioned to you in this thread.

Now, answering your specific questions:

  1. The error message is quite descriptive - you have more than one element marked as KeyPath='yes' in a single component. There can only be one key path. You can find more information here (see the section describing KeyPath column of the Component table).
  2. I think you can safely move the usermodule.exe into a separate component. If you say that stopping the service drops that process, and we know that service operations on uninstall happen before the file removal, then it sounds safe to just let Windows Installer do its job uninstalling the components.
  3. As mentioned in the previous point, I don't think so.

Hope this helps.

share|improve this answer
add comment

Your Answer


