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

Custom Action always being executed, when it shouldn't

Jump to solution

Hi all,

I have a custom action which executes a batch file. This should not run on uninstall so I have a 'NOT REMOVE' condition on the custom action, but every time I run the installer and try to uninstall it, it is throwing an error about this custom action. This is being thrown because the batch file doesn't exist anymore. (but it shouldn't even try to execute it) How do I fix this?

Labels (1)
0 Kudos
1 Solution
shunt
Revenera Moderator Revenera Moderator
Revenera Moderator

To run the custom action only during Installation, use the condition:

Not Installed

Alternatively another approach is to  prevent the custom action during uninstall which you can use:

Not REMOVE~="ALL"

There's a really helpful conditions cheat sheet which you might find useful for the future here: https://community.flexera.com/t5/InstallShield-Knowledge-Base/Common-MSI-Conditions/ta-p/3854

View solution in original post

4 Replies
shunt
Revenera Moderator Revenera Moderator
Revenera Moderator

To run the custom action only during Installation, use the condition:

Not Installed

Alternatively another approach is to  prevent the custom action during uninstall which you can use:

Not REMOVE~="ALL"

There's a really helpful conditions cheat sheet which you might find useful for the future here: https://community.flexera.com/t5/InstallShield-Knowledge-Base/Common-MSI-Conditions/ta-p/3854

Thanks that's exactly what I needed. I find it really hard to find the relevant information for my problems. Whenever I google something I never get the pages that I actually need. Really annoying. Thanks for your information!

0 Kudos

If I only want to execute a custom action when the relevant component is being installed, what should I use? I think it would be '?ComponentName = 3', is that correct?

0 Kudos

Hi @gomochainstall,

Thank you for your post.

You would need to use a component action condition:

$ComponentName = 3

A feature state condition is based on the feature's current state when the install starts. A feature action condition is based on the feature's final state when the install completes. Respectively, a component state condition is based on the component's current state when the install starts. A component action condition is based on the component's final state when the install completes.

Here is a link to the official Microsoft documentation about conditional statement syntax:

https://docs.microsoft.com/en-us/windows/win32/msi/conditional-statement-syntax?redirectedfrom=MSDN

Specifically, the Feature and Component State Values Section discusses this topic.

Please let us know if you have any questions or concerns. Thanks!

0 Kudos