Arpad
Posts: 5
Joined: Fri Mar 16, 2012 9:30 am

how to set an installer property through user edit controls

Dear Customer Support,

We are creating an installer project with Advanced Installer and need to set an installer property through the dialogs based on user interaction, and read that property later as a condition.

The scenario is the following:
1. In the Dialogs section, we create a new dialog. In the dialog, we place a combobox.
2. In that combobox, we set the Property Name property to Deployment_Env.
3. In that combobox, we place 2 items, with item1 value Env1 and item2 value Env2.
4. Later on, in the Organization section, under Features and Components we would like to install certain features based on a condition.
5. We select a feature, and set the condition to Deployment_Env = "Env1".
6. We select another feature, and set the condition to Deployment_Env = "Env2".

Now what happens during running the installer is that the condition is not taken into account. Doesn't matter what we select in the combobox, it will always take the default value of the Deployment_Env property, which is Env1.
Could you please help us out with how to write an installer property and how to read it properly later? We are not sure what goes wrong where... whether we are not setting it, or not reading it properly?

Kind regards,
Arpad
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to set an installer property through user edit contr

Hi Arpad,

This happens because the conditions for the features are evaluated before the UI changes, so the defaults are always used. To trigger their re-evaluation you need you call our predefined custom action "Update Features Install States", for example using a DoAction event on the Next button from that dialog.

Here are some articles to help:
Update Features Install States
How do I execute a custom action when a button is pushed?

Also, I recommend you to use only public properties, i.e. instead of Deployment_Env you should use DEPLOYMENT_ENV. This is because Windows Installer resets private properties when passing from InstallUISequence to InstallExecuteSequence, which could lead to unexpected behavior.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”