[wix-users] RemoveRegistryKey in an upgrade - action NOT wanted during RemoveExistingProducts

Alan Sinclair anadem at gmail.com
Sun Apr 22 08:58:32 PDT 2018


The problem: registry key is deleted during upgrade, but we need it deleted
only at final uninstall.

(Originally written 2018-04-20 but maybe wrongly addressed - for some
reason not showing in the mailing list so re-posting)

Is there any way to do set up my dual-scope install so that at uninstall it
removes a registry key (from the appropriate HKLM or HKCU hive depending
whether it's in per-machine mode or per-user mode) ONLY AT FINAL UNINSTALL,
not at upgrade?
All the dual-scope stuff is working cleanly and properly now (including
upgrades!) thanks to all the great help from this list, except cleaning up
the registry keys which were set by the app i.e. not set by components in
the installer.

I have RemoveRegistryKey in a component conditioned on NOT
UPGRADINGPRODUCTCODE but that doesn't do what we need: the key is removed
during an upgrade, when the initial install is removed in
RemoveExistingProducts.

This is what I've got:

        <DirectoryRef Id='TARGETDIR'>
            <Component Id="AlanRemoveRegHKLM"
Guid="3A735F83-591B-4E25-B1CB-1498A6770873" Win64='$(var.V_WIN64)'>
                <Condition> ( not UPGRADINGPRODUCTCODE ) and ALLUSERS
</Condition>
                <CreateFolder></CreateFolder>
                <RemoveRegistryKey Root="HKLM"
Key="Software\Myapp\Settings" Action="removeOnUninstall" />
            </Component>
<!--Perhaps the above AlanRemoveRegHKLM component is redundant .. haven't
checked -->
            <Component Id="AlanRemoveRegHKCU"
Guid="4950E1DD-A5FB-42D6-A872-A74230ED8841" Win64='$(var.V_WIN64)'>
                <Condition> ( not UPGRADINGPRODUCTCODE ) and ( not ALLUSERS
)</Condition>
                <CreateFolder></CreateFolder>
                <RemoveRegistryKey Root="HKMU"
Key="Software\Myapp\Settings" Action="removeOnUninstall" />
            </Component>
        </DirectoryRef>


I'm ignoring this warning:

c:\projects\ws\wixsetup\wsoptions.wxs(285) : warning LGHT1076 : ICE57:
Component 'AlanRemoveRegHKCU' has a registry entry that can be either
per-user or per-machine and a per-machine KeyPath.
C:\Users\AlanSinclair\AppData\Local\Temp\3crnd1nz\myapp-en-us.msi : warning
LGHT1076 : ICE105: msidbRegistryRootLocalMachine or msidbRegistryRootUsers
cannot be defined as root for per user install of application.

How to make this aware of UPGRADINGPRODUCTCODE ? Do we need a custom action
to save and restore the key over an upgrade?

(Also, I don't know if the condition REMOVE~="ALL" is required in the
condition when Action=" removeOnUninstall " .. is it?)

Any ideas?
Thanks


More information about the wix-users mailing list