We have a wix setup project that installs and several COM dlls and a service using ServiceInstall. The COM dlls also have associated registry keys extracted with heat.exe to avoid issues with SelfRegCost.
However, the two seem to have conflicting requirements:
- The COM dlls registry keys need 'RemoveExistingProducts After="InstallInitialize"' to avoid wiping the registry information if uninstalling after installing, e.g. if a dll path is modified on an upgrade.
- The service need 'RemoveExistingProducts After="InstallExecute"' (or later) to avoid loosing the service account credentials on an upgrade.
I have read a ton of related questions/answers about msi, wix, services and COM but did not find a solution.
What is the correct way to solve this?
EDIT:
The installer uses 'automagic' generated component GUIDs, and has only one file per component. The exception is the COM dll components which are as generated by heat, i.e.:
<Component ...>
<File ...>
<TypeLib ...>
<Class ...>
...
</file>
<RegistryValue ... HKCR...>
...
</Component>
It has 2 custom actions, which registers and un-registers a COM server (exe) because I could not figure out what else to do, as heat could not extract it.
It does write registry keys, to HKCR and HKLM, but none to HKCU.
It installs ~20 third party files COM files (.ocx), and currently installed into System32. It also install a number of third party files in our own folder.
Then it installs ~15 proprietary COM dlls and a number of non-COM files (incl. the service) to our own folder.
The service is installed using the Wix 'ServiceInstall' with a default account 'LocalSystem', but the user changes this after the first installation. The account information is not known by us. Unfortunately, in many cases the service needs access to network share(s) to read large images, so I do not see how this can work with a built in account.
As far as I know, no shared files.
I agree that RemomveExisting AfterInstallFinalize is preferable, so if we can get it to work with the COM registrations, that would be great.
Including help files (chm and pdf 177MB) it ends at 250MB.
UPDATE
The service issue is fixed if we use 'AfterInstallFinalize'. However, this leaves us with the COM dll issue.
We have created a test installer which installs just one COM dll and its corresponding registry keys (TypeLib...).
As expected, when upgrading it works fine IF the component is not modified. I.e. both the dll path and the auto-generated component-guid are unchanged.
But, if the dll path IS modified, effectively we install a new component, then the associated COM registry keys are removed after the installation, probably by RemoveExistingProducts. We tried but using the auto generated guid, and hard-coded to the same guid as the previously installed guid.
The issue seems to be that the dll path changes but most of the registry key do not. E.g. all the 'class' keys are missing. This is what I meant when I said 'wiping the registry information'. A repair of the installation brings back the COM registry keys.
So I guess my question boils down to: How do we correctly install/update COM dlls, so the COM registry keys are not un-installed if the file path is changed? Is this possible using REP=AfterInstallFinalize?