0

I'm trying to launch the software I'm installing with some parameter after the install to perform an initialization task. I want to launch the custom action only after the first install and not after an upgrade.

The following code launches the custum action after both the first install and an upgrade.

<CustomAction Id="MyAction"
    Directory="TARGETDIR"
    ExeCommand="[INSTALL_ROOT]MySoft.exe myarg"
    Execute="immediate"
    Return="ignore"
    Impersonate="yes" />
<InstallExecuteSequence>
    <Custom Action="MyAction" After='InstallFinalize'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE) </Custom>
</InstallExecuteSequence>

What is the issue?

skuallpa
  • 1,147
  • 3
  • 13
  • 28

1 Answers1

2

Run the MSI and create a log with msiexec /I [path to msi] /l*vx [path to log file] and look at when your custom action is called and what the log says about it.

Would you know if the program started and crashed because (e.g.) it requires elevated privilege? You're assuming that the install is at fault because presumably you don't see the result of your program running, but if it crashed how would you know? The log will tell you if it tried to run it, and note that saying return=ignore means that the install carries on even if it fails.

If "after an upgrade" means that this is the upgrade MSI then your condition is wrong because UPGRADINGPRODUCTCODE is set when you are being upgraded, not when your product IS the upgrade. You need WIX_UPGRADE_DETECTED as the condition if this is the upgrading setup.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • Thx! WIX_UPGRADE_DETECTED is what I needed. And thanx for the hint for the log, very usefull for debugging. This [other post] (http://stackoverflow.com/questions/18531272/how-do-i-distinguish-between-a-normal-install-and-an-upgrade-in-wix) was very usefull too to identify different scenarios. – skuallpa Jan 11 '17 at 07:28