How to: Set Conditional Installation Based on User Choices
The Condition property can be used to add conditional logic to an installer (for example, to allow a user to choose whether a file will be installed). During installation, the condition is evaluated and the file is installed only if the condition evaluates to true.
The following example illustrates using a RadioButtons User Interface dialog box to conditionally install a file.
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see.
To install a file based on a user's choice
In the User Interface Editor, select the Start node under Install.
On the Action menu, choose Add Dialog.
In the Add Dialog dialog box, select the RadioButtons (2 buttons) dialog box.
On the Action menu, choose Move Up twice, moving the RadioButtons (2 buttons) node just below the Welcome node.
All custom dialog boxes must precede the Installation Folder dialog box (or Installation Address dialog box for a Web Setup project).
Select the RadioButtons (2 buttons) node in the User Interface Editor. In the Properties window, select the BodyText property and describe the choice being presented (for example "Do you want to install the readme file?").
Select the Button1Label property and describe the first option (for example "Install the readme file").
Select the Button2Label property and describe the second option (for example "Do not install the readme file").
On the View menu, point to Editor, and then click File System.
Select a file in the File System Editor.
In the Properties window, select the Condition property and type BUTTON2=1.
This condition uses the ButtonProperty property (BUTTON2) of the RadioButtons (2 buttons) dialog box, which returns either the Button1Value (1) or Button2Value (2) property depending on which button is selected during installation. If the first button was selected, the condition BUTTON2=1 evaluates to true and the file will be installed.
In the above example, the ButtonProperty property uses the default value "BUTTON2". In most cases, you will want to change this to a more meaningful name such as "InstallReadme".