1
votes

I have an installer created with InstallShield 2012. I now have a need to allow the user to optionally run a custom action as part of their uninstall.

To achieve this I have currently added a check box to one of our dialogs. The checkbox is associated with a property and has the default set to 'True' (the 'Value' is set to '1'). In the PropertyManager the property has been added with a Value of '1'.

For the custom action the condition is set to REMOVE="ALL" AND MyCheckboxProp=1. When running the installer the checkbox appears initially checked. However, looking in the logs I can see that the condition always evaluates to True even when the checkbox is toggled to the unchecked state.

When the checkbox is unckecked the installer log reports:

PROPERTY CHANGE: Deleting MyCheckboxProp property. Its current value is '1'.

At first I wondered if the issue could relate to the fact that the action was running with 'Deferred Execution'. However, even running a test action with 'Immediate Execution' I can see that the condition always evaluates to 'True'.

As expected from the above, a test action which displays the property value shows it is always 'True'.

Is there a step I'm missing?

1

1 Answers

2
votes

The key concept that was missing is that the Windows Installer component which interprets the MSI actually has a notion of public, private, and restricted public properties.

In this case a property value is being referred to in both the user-interface and the execution phase. The documentation for public properties states that:

Properties that are to be set by the user interface during the installation and then passed to the execution phase of the installation must be public.

To mark a property as public it should be specified such that the name contains only uppercase letters (see Restrictions on Property Names). In the example given in the question, the property name contains some lower case letters, and as such, was being interpreted as private.

The additional benefit of marking a property as public is that it allows the property to be set on the command line and it can then be specified when performing a silent install.