View Full Version : Custom Action with Condition will not run!

12-07-2004, 10:51 AM
I'm stumped and would really appreciate some help...

My project has two features (call them A and B), in addition to the Always Install. It also has a couple of custom actions that reside just after the "Before System Changes" (during uninstallation) that simply stop a service and then remove the service. Both custom actions have a condition set such that they should only run if feature "B" was set to be installed.

Now, this used to work! In a previous install package, this exact setup worked just fine, but now the only way I can get those two custom actions to run is to remove the Condition. That is, I'll install using feature "B", yet the custom actions won't run!

Has anyone seen this sort of thing before?

Thanks in advance,

12-08-2004, 01:56 AM
If you are not testing on a clean machine, I would suggest repeating your testing on one to be sure. In any case, you will want to create and analyze the installation log.

12-08-2004, 11:00 AM
It still occurs on a clean machine. Also, I can create an installation log, but the problem occurs upon uninstallation (that's were the custom actions are). I don't see how a log can be created for the uninstallation sequence. That is, is there another way to set up logging other than using the "Test Your Setup" feature within ISX?



12-08-2004, 11:54 AM
You can rerun your installation with logging switch, /l*v, on the machine that has the installation installed. It will get into maintenance mode, and you can uninstall with logging enabled. Alternative is to set Machine Policies (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/machine_policies.asp).

As an aside, I will not recommend testing an installation on the development machine.

12-08-2004, 01:06 PM
Thank you for your reply.

Rather than work with a somewhat complex install package, I created a brand new install package with a total of three features:

Always Install

The Typ feature is installed when the user chooses a "typical" setup feature, and the Min feature is installed when the user chooses "minimum" setup feature. Each feature consists of a single text file being copied into the program files folder. Then, I added a single custom action within the "Before System Changes" header under the uninstall category, called "ShowCMDBox". This action runs the following exe on the target computer:

<systemfolder>cmd.exe /c pause

The custom action has a condition that the "Typ" feature be installed. As with my other project, this custom action does not run as it should. If I remove the condition, it will run. I've also changed the condition to run if the other feature is installed (Min) and it still won't work in this case. It seems that the custom action will only run if no conditions are in place.

I also ran the logging as you suggested, and found that the custom action did not run because the condition was deemed false by the installer (according to it, the "Typ" feature was not installed). The exact line in the log is:

"Skipping action: ShowCMDbox (condition is false)"

I'm stumped, because this was a brand new install package that has nothing to do with my original package.

I appreciate your advice regarding not installing packages on my developement computer. I have done this in the past but I won't anymore.

Do you have any other things I can try? Again, thank you very much for your help so far.


12-08-2004, 01:27 PM
Are you checking feature state or action in your condition? For distinction and examples, please refer to Conditional Statement Syntax (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/conditional_statement_syntax.asp).

12-09-2004, 12:21 PM
I bulit the exact same project as described above on an absolutely clean install of WinXP (the only other app installed was ISX). Same results. The condition does not fire because the installer evaluates is as 'false'. As noted above, the condition is that the "Typ" feature be installed, which it was.

I can't understand why this is happening! I hope I'm not being an idiot about this, but I just can't see where I've made a mistake, and I know this used to work for me only a few weeks ago.


12-09-2004, 12:43 PM
oops, didn't see post #6...

The condition is built by ISX using the condition builder dialog. In the .ise file it's listed as follows (using ORCA):

Table: InstallExecuteSequence
Action: ShowCMDBox
Condition: Installed AND (&NewFeature2 > 2)

So, if I understand this correctly, I should be checking the state of this feature, not it's action. Therefore, replace the "&" with "!" ? I'll give it a try...

(thanks again)


12-10-2004, 02:36 AM
Well, it worked!! If I check the state of the feature using the "!" it works great. I can't thank you enough for your help.

However, I still can't understand why this worked before using the condition builder in ISX and not now. That is, I never needed to hack into the project before (using ORCA) and edit the condition. Also, if every condition placed within the uninstall section requires this hack, what good is the condition builder for this instance?

Anyway, thank you again. Your help is greatly appreciated.


12-10-2004, 02:29 PM
At uninstallation, all features are set to be uninstalled. Hence, the feature action condition on custom actions will be evaluated to FALSE. Since the condition statement is predetermined, its effectiveness is limited to certain scenarios.

12-10-2004, 02:35 PM
I see. Thanks again!