What conditions do I use for a custom action in a merge module such that the action runs only on initial install of an application and does not run on upgrade or repair? Likewise, I need a condition that runs another CA at uninstall only. (This is an embarrassingly newbie question despite my doing packaging for years!)

We have several apps which need to set the same DWORD registry flag. The apps can be installed together (independently) on the same machine, so the flag must not be unset if one app is uninstalled while another is in place. Unfortunately the only permissible values for the flag are zero (or unset) and one.

I coded a C dll to be called from two custom actions to manage a "reference count" (in the registry, separate from the flag). When an app is installed the first CA increments the refcount, and when uninstalled the other CA decrements the refcount. When the refcount is zero, the flag is cleared. This goes in a merge module, to be included in all relevant apps. But I can't get the conditions right for the custom actions.

Please enlighten me.
0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Condition to use at initial install -> If NOT Installed Then ...
Condition to use at removal -> If REMOVE="ALL" Then ...
Answered 03/04/2011 by: yuri
Orange Belt

Please log in to comment
> NOT Installed

Thanks! I so should have remembered!
But unfortunately those are also true during an upgrade.

"REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE" works to suppress the CA during uninstall phase of an upgrade.

Is there a *generic* way to tell if an install is an upgrade? I know the property from the Upgrade table can be used, but because these CAs are in a merge module, the Upgrade table property is indeterminate (unless I can convince the consumers of the merge module to use a pre-defined property name.) So, is there any other way to know it's an upgrade?
Answered 03/04/2011 by: anadem
Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity