[wix-users] RemoveRegistryKey in a dual-scope MSI

Dzmitry Razhanski Dzmitry_Razhanski at epam.com
Mon Apr 23 10:06:30 PDT 2018


Hello,

Probably you need to use these attributes for your component:
	 Permanent="yes" NeverOverwrite="yes"
And remove it manually by condition.


Best regards,
	Dzmitry Razhanski.

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Alan Sinclair via wix-users
Sent: Saturday, April 21, 2018 8:40 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Alan Sinclair <anadem at gmail.com>
Subject: Re: [wix-users] RemoveRegistryKey in a dual-scope MSI

correction (I'd copypasted an older version, sorry), my code includes CreateFolder like this, otherwise it errors.

        <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>


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

thanks
Alan

On Fri, Apr 20, 2018 at 10:18 PM, Alan Sinclair <anadem at gmail.com> wrote:

> 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.
>
> This is what I've got:
>
>         <DirectoryRef Id='TARGETDIR'>
>             <Component Id="AlanRemoveRegHKLM" Guid="myguid"
> Win64='$(var.V_WIN64)'>
>                 <Condition> ( not UPGRADINGPRODUCTCODE ) and ALLUSERS 
> </Condition>
>                 <RemoveRegistryKey Root="HKLM"
> Key="Software\Myapp\Settings" Action="removeOnUninstall" />
>             </Component>
>             <Component Id="AlanRemoveRegHKCU" Guid="myguid2"
> Win64='$(var.V_WIN64)'>
>                 <Condition> ( not UPGRADINGPRODUCTCODE ) and ( not 
> ALLUSERS )</Condition>
>                 <RemoveRegistryKey Root="HKMU" Key="Software\Myapp\ 
> Settings " Action="removeOnUninstall" />
>             </Component>
>         </DirectoryRef>
>
> which gets 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
> Alan
>
>

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list