cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
savy17
Level 5

custom action based on feature selection not executing correctly

I am using Basic MSI.

In my insaller, I have a feature and 2 subfeatures under this feature. By default, all the featuers and subfeatures are set not to install. So I set the install level for the feature and all 2 subfeatures to 200 (which is greater than INSTALLLEVEL value).

I have 4 custom action related to these 2 subfeatures. Two for each subfeature. Say for first subfeature Feature1, I have two custom actions CAFeature1Add and CAFeature1Remove. and for second subfeature Feature2, I have CAFeature2Add and CAFeature2Remove.

During installation, if subfeature is selected, its related "Add" custom action needs to be run and if subfeature is not selected, its related "remove" custom action needs to be run.

So if Feature1 is selected and Feature2 is not selected, then custom actions CAFeature1Add and CAFeature2Remove needs to be executed.

I have set the condition to execute these custom actions as $feature1.dll=3 for CAFeature1Add and $feature1.dll<>3 for CAFeature1Remove. feature1.dll is present only when Feature1 is installed. Similar conditions check for $feature2.dll is done for Feature2 custom actions

The behavior that I am seeing is -

During fresh install, all the features in feature selection dialog are shown as do not install. If I choose to say install Feature1 and leave Feature2 as not install, the custom action that will be running are CAFeature1Add and CAFeature2Remove.

Now during maintenance mode during modify, if I chose to say also install Feature2 (so at this stage, both features are set to install. Feature1 already installed, Feature2 set to install), the custom action that runs are CAFeature1Remove and CAFeature2Add.

But actually it should have run CAFeature1Add and CAFeature2Add because Feature1 is still selected. I can see the dll for feature1 is still there but the custom action condition returns false condition.

BUT if I simply click on Feature1 selection tree without changing it (i.e. Feature1 is still said to be install as it has been installed during first time install, I simply clicked on that feature selection tree only), then I see that CAFeature1Add is called now... Seems once the feature is clicked, then only correct condition is triggered

I even tried with checking for feature name instead of component for execution condtion but still same result...

Can anyone please help how to solve it
Labels (1)
0 Kudos
(1) Reply
savy17
Level 5

I figured it out. Execution condtion were not correct for remove custom action. Also, instead of checking for component, now I am checking for feature. The condition that I have set are for Add, &Feature1=3 and for remove &Feature1=2

savy17 wrote:
I am using Basic MSI.

In my insaller, I have a feature and 2 subfeatures under this feature. By default, all the featuers and subfeatures are set not to install. So I set the install level for the feature and all 2 subfeatures to 200 (which is greater than INSTALLLEVEL value).

I have 4 custom action related to these 2 subfeatures. Two for each subfeature. Say for first subfeature Feature1, I have two custom actions CAFeature1Add and CAFeature1Remove. and for second subfeature Feature2, I have CAFeature2Add and CAFeature2Remove.

During installation, if subfeature is selected, its related "Add" custom action needs to be run and if subfeature is not selected, its related "remove" custom action needs to be run.

So if Feature1 is selected and Feature2 is not selected, then custom actions CAFeature1Add and CAFeature2Remove needs to be executed.

I have set the condition to execute these custom actions as $feature1.dll=3 for CAFeature1Add and $feature1.dll<>3 for CAFeature1Remove. feature1.dll is present only when Feature1 is installed. Similar conditions check for $feature2.dll is done for Feature2 custom actions

The behavior that I am seeing is -

During fresh install, all the features in feature selection dialog are shown as do not install. If I choose to say install Feature1 and leave Feature2 as not install, the custom action that will be running are CAFeature1Add and CAFeature2Remove.

Now during maintenance mode during modify, if I chose to say also install Feature2 (so at this stage, both features are set to install. Feature1 already installed, Feature2 set to install), the custom action that runs are CAFeature1Remove and CAFeature2Add.

But actually it should have run CAFeature1Add and CAFeature2Add because Feature1 is still selected. I can see the dll for feature1 is still there but the custom action condition returns false condition.

BUT if I simply click on Feature1 selection tree without changing it (i.e. Feature1 is still said to be install as it has been installed during first time install, I simply clicked on that feature selection tree only), then I see that CAFeature1Add is called now... Seems once the feature is clicked, then only correct condition is triggered

I even tried with checking for feature name instead of component for execution condtion but still same result...

Can anyone please help how to solve it
0 Kudos