mgorga
Posts: 45
Joined: Fri Jun 03, 2011 1:00 pm

Conditional install feature

Hello,
I have a feature that I want to install using a conditional based on a property value. In your "how to" you have this video:
https://www.youtube.com/watch?v=XAowXcmQ-kA

It is working but I have a large number of components grouped on a "feature". So to conditional install the feature I can not configure with copy/paste of the conditional in all the components. Instead I am modifying the feature (not the component). I had selected on "Installation Behaviour" the option "Not installed" and then a add the conditional on "Installed if". This solution is working on a clean installation with no previous installations of my product. But it fails if a make an upgrade. To reproduce the error:
1. Install the product and select to install MyFeature
2. Create an installer with new version of my product
3. Now update the my product. This time, unselect the option to install MyFeature

I am expecting that files associated to MyFeature were removed but it is not doing that. It fails too if I add MyFeature on the update process. I tested my project moving the conditional from feature to component, and then I have the expected behaviour. The problem is that I have many installers and many components, so to apply this workaround I will need a long time and it is going to generate a problem on future for maintenance of my installers.

Best regards,
Mario
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: Conditional install feature

Hello Mario,

Please note that this is the expected behavior.

This is happening due to the MigrateFeatureStates standard action.During an upgrade it reads the feature states in the old version and then sets these feature states in the new version.

In order to avoid this behavior, please proceed as it follows:

- go to "Upgrades" page

- check the "Customize Advanced Installer upgrade rules" option

- double click on the rule that contains the "OLDPRODUCTS" as a property

- please click on the "Upgrade Action" tab --> uncheck the "Enable Migrate Features action" option
migrateFeatures.png
migrateFeatures.png (136.16 KiB) Viewed 8499 times
Besides that, as a piece of advice, it would be nice to mark the property of your checkbox as persistent, so it can preserve its value during maintenance and upgrade. For instance, if the default value of your checkbox is checked and the user unchecks it at install time, then during upgrade it would be a nice experience for the checkbox to be unchecked (as the user unchecked it during the first time install).

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mgorga
Posts: 45
Joined: Fri Jun 03, 2011 1:00 pm

Re: Conditional install feature

Thank you!
I have changed it and now it works with the behaviour that it fits to my needs.

About persistent properties I have already configure it, thank you for the advice. In fact, I made a question about that on the past (viewtopic.php?f=2&t=33926&p=109810#p109810)

Best regards,
Mario
Catalin
Posts: 6608
Joined: Wed Jun 13, 2018 7:49 am

Re: Conditional install feature

You are always welcome, Mario!

I am really glad everything is working as expected now.

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

Return to “Common Problems”