antoine
Posts: 2
Joined: Mon Nov 04, 2019 4:21 pm

String comparison issue with ADDLOCAL in Feature Properties

Mon Nov 04, 2019 6:09 pm

Hello support,

In my program I have multiple features like:
- FeatureA
- FeatureB
- FeatureC
- FeatureD

I would like to install .Net Core Runtime only if "FeatureA" and "FeatureB" have been selected.

So, I've added the .Net Core Runtime as a prerequisite 'Feature-based' which is 'Not Displayed' in the Feature Tree.
In the 'Installation Behaviour', I've set 'Not Installed', 'Install if:'

Code: Select all

(ADDLOCAL >< "FeatureA") OR (ADDLOCAL >< "FeatureB")
according to the operator indicated in the documentation.

But it doesn't work.

I've tried also with:

Code: Select all

(ADDLOCAL >< FeatureA) OR (ADDLOCAL >< FeatureB)
It doesn't work too.

If I select only "FeatureA" and if my condition is

Code: Select all

ADDLOCAL = FeatureA
It works.

If I select only "FeatureA" and if my condition is

Code: Select all

ADDLOCAL = "FeatureA"
It doesn't work.

If I select only "FeatureC" and if my condition is

Code: Select all

(ADDLOCAL = FeatureA) OR (ADDLOCAL = FeatureB)
It doesn't work .Net Core is installed but it shouldn't be.

It looks like a type issue. In the logfile created in %TMP% folder, if I search for 'ADDLOCAL', I can notice that in opposition to the other arguments in the command line, values of 'ADDLOCAL' are without double quote.

Any advice would be greatly appreciated.

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: String comparison issue with ADDLOCAL in Feature Properties

Wed Nov 13, 2019 9:46 am

Hello Antoine and welcome to Advanced Installer forums,

First of all, please accept my apologies for such a delayed reply.

Please allow me to quickly try and explain why this works and does not work in several scenarios:

- first of all, the conditions are evaluated during the CostFinalize standard action. At that moment in time, the ADDLOCAL property is empty, therefore the condition is evaluated as false (e.g. ADDLOCAL = "FeatureA")

- based on those said above, this is why a condition like this works: ADDLOCAL = FeatureA. If you do not add the quotes, FeatureA is treated like a property which has no value, therefore is empty. Since ADDLOCAL is also an empty property, the condition will then be evaluated as true => your prerequisite is installed
If I select only "FeatureC" and if my condition is
The above point explains why this happens. Basically the condition is evaluated as true because all properties (ADDLOCAL, FeatureA, FeatureB) are empty.

Now, in order to achieve what you want, please follow these steps:

1. please go to "Organization" page and remove the condition from the feature that contains your prerequisite

2. now please go to "Custom Actions" page and add the "UpdateFeaturesInstallStates" custom action, without sequence (i.e. press the "Add custom action without sequence" button which is placed to the right side of the custom action's name)

3. now please go to "Dialogs" page, click on "ConfigureDlg" and under "Published Events" tab, please add the following events:

Event1:

Event: Execute custom action
Argument: UpdateFeaturesInstallStates
Condition: leave unchanged


Event2:

Event: Install one or more features locally
Argument: click the dropdown and select your prerequisite
Condition: ((&FeatureA = 3) OR (&FeatureB = 3))

Install.png
Install.png (191.05KiB)Viewed 2896 times
Basically, the above condition can be translated to: FeatureA will be installed locally OR FeatureB will be installed locally (i.e. is selected)

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

antoine
Posts: 2
Joined: Mon Nov 04, 2019 4:21 pm

Re: String comparison issue with ADDLOCAL in Feature Properties

Fri Nov 15, 2019 9:33 am

Hello Catalin,

Thank you very much for the details.

It was very helpful.

Best regards,
Antoine

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: String comparison issue with ADDLOCAL in Feature Properties

Fri Nov 15, 2019 4:57 pm

You are always welcome, Antoine.

I'm really glad the explanation was helpful for you.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”