Preserving registry keys on update

Having trouble running Advanced Installer? Got a bug to report? Post it all here.

Preserving registry keys on update

Postby rscaster » Tue Feb 27, 2007 1:04 am

Hi,

I have a registry key for the product which is managed by Advanced Installer (added/removed on install/uninstall). After the product has been installed and while it's being used, registry keys and values are added under the product registry key. I want these keys to be deleted on uninstall, but remain intact while updating with newer version. I searched the forum and understood how to preserve a single registry value, but it doesn't help me much. First I couldn't find how to preserve a key and second the keys and values are created by the user, so they are unknown during installation. Is there a way to achieve the requested scenario with AI?

Thanks in advance
rscaster
 
Posts: 6
Joined: Wed Jan 03, 2007 11:10 am

Postby gigi » Tue Feb 27, 2007 10:45 am

Hi,

This can be done with a custom action in a similar way like in the following tutorial (you need to create your own Backup and Restore VBS functions):
http://www.advancedinstaller.com/user-g ... le-ca.html

But more easy is to mark the component associated with the registry key ("Organization" page) as "Never Overwrite". Now you need to prevent the "RemoveRegistryValues" standard action from being executed on upgrade. To do that open the previous version of your package with Orca (tool that comes with Platform SDK), choose "InstallExecuteSequence" from tables list find the "RemoveRegistryValues" action and type NOT UPGRADINGPRODUCTCODE in the "Condition" column.

This second approach will work only if the previous version of your package is not already on the market.

Hope this helps.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
gigi
 
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am

Postby rscaster » Sat Mar 03, 2007 6:44 pm

Thanks for the answer! Your support here in the forum is great - it's very nice to get answers so soon! :)

As for the problem, unfortunately I cannot use the second way because we build an exe, not msi. I didn't like the idea of writing VB script for backup, so decided to write a custom dll to be called by AI, which will probably give me much more freedom in what I want to do.

Best regards
rscaster
rscaster
 
Posts: 6
Joined: Wed Jan 03, 2007 11:10 am

writing a dll/code is crazy

Postby srm2710 » Fri Apr 20, 2007 4:47 pm

I have the same problem.

I have removed the tick from 'Delete (if present) on uninstall' from the Key's properties dialog, that does not seem to alter anything.

If I upgrade an existing installation, existing user generated registry keys are removed from the registry. I have even removed all install-time registry creation, but AI insists on removing user generated keys. I would describe this as a BUG.

Question: after paying a lot of money for AI: why should I have to write a load of code to get around what has got to be a simple task for AI: namely, offering the option to 'leave existing keys alone'.
srm2710
 
Posts: 13
Joined: Thu Feb 09, 2006 6:01 pm

Postby gigi » Mon Apr 23, 2007 11:59 am

Hi,

If I upgrade an existing installation, existing user generated registry keys are removed from the registry. I have even removed all install-time registry creation, but AI insists on removing user generated keys. I would describe this as a BUG.

This is not a bug. Windows Installer does not offer directly support for this. To prevent a registry key being overwrite on upgrade you need to use a custom action. For a similar approach please see following thread:
http://www.advancedinstaller.com/forums ... .php?t=971

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
gigi
 
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am

Postby srm2710 » Fri Apr 27, 2007 3:05 pm

many thanks,

i have 50+ user generated registry values to contend with though.

i read the help topic about using a script to preserve files by moving them to a temp location, but, as far as i know, i can't access the HKEY_CURRENT_USER\Software\ section of the registry with vbscript. In any case, i assume i would need to set up 50+ properties under install parameters to store and access the values from script.

Is there any hope you can give me? - I admire your support, but msi keeps knocking us back from what was a pretty straight forward distribution/task.

If I go the patch route will user-generated registry values be left alone?
srm2710
 
Posts: 13
Joined: Thu Feb 09, 2006 6:01 pm

Postby gigi » Wed May 02, 2007 9:32 am

Hi,

Just to clarify. Those registry values are created by the installer or by your application?

If they are created by your application (under a key created by the installer) then those registry values are not removed on uninstall or upgrade (unless you have the "Delete (if present) on uninstall" option checked in the "Edit Registry Key" dialog).

Since user created registry keys are not known to the installer you can create a custom action (to delete them) that will be executed only on uninstall. To execute the custom action only on uninstall use following condition: (REMOVE="ALL" AND (NOT UPGRADINGPRODUCTCODE))

This approach implies that the "Delete (if present) on uninstall" option to be unchecked.

Hope this helps. Let me know if it's something that you don't understand.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
gigi
 
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am


Return to Common Problems

Who is online

Users browsing this forum: Google [Bot] and 4 guests