r.mens
Posts: 2
Joined: Sun Jan 29, 2006 6:30 pm

Not overwriting or delete registry key on update

Hi Guys,

I would like to know how can I create an update of my MSI which does not overwrite a registry value I previously created (if it exists). It may be uninstalled when uninstalling the application.

I need this because that particular registry value refers to the location of a file. The location of the file can be changed by the user, after which he changes the registry value in my program. When upgrading the product, the registry value with the file location should not be altered.

I saw an option on the registry key "Create (if absent) at install". This option is not available for registry values. Please let me know if there is any way I can do this with the current released version (3.6.1)

Thanks in Advance,
Ronald
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,

These are the steps you should follow:

1. In the Search page of AdvInst, create a new Registry Search for your registry value. Select "Retrieve the raw value" in the type combobox. You can also use the wizard accessible using "Wizards -> Search". In what follows I shall assume you have selected REGVALUE as the name of the property that will store the Search result.

2. In the Custom Actions page create a new "Property Set with Formatted" Custom Action scheduled on the "CostFinalize" stage.
a) In the Property Name field enter "REGVALUE" (without quotes)
b) In the Formatted Text field enter the default value for this property (it could be the location of a file included in your package). Use the "Edit" button at the right of the Formatted Text field and the "Edit Custom Action Parameters" dialog in order to insert a reference to a file, folder or Windows Installer property.
c) Set the Execution Condition to: NOT REGVALUE

This Custom Action will set the default data which will be written to the registry in case the Search is not successful.

3. In the Registry page, create the desired value. In the Data field (from the "Edit Registry Entry" dialog) enter:

Code: Select all

[REGVALUE]
This will set the data for your registry entry to the value of the property REGVALUE (whether it has been set by the Registry Search or the Property Set with Formatted Custom Action).

Hope this helps.

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Feature Requests”