CustomAction to run installed program fails only during upgrade

0

I am generating a silent installer to install our product on local machines via group policy, as we switch away from clickonce deployments. Definitely a novice in the installer department, but I'm getting the hang of it. The appilcation is installed PerUser and works perfectly for installing, upgrading and uninstalling. Problem is, as soon as I throw in a Custom Action within InstallExecuteSequence to run the installed program, it causes the upgrade install to fail, but works perfectly for a clean install. After scouring msi logs, I found this:

WixShellExec:  Error 0x80070002: ShellExec failed with return code 2.
WixShellExec:  Error 0x80070002: failed to launch target
CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 8:46:20: LaunchApplication. Return value 3.

When this occurs, it seems as if it's looking for the program's exe file after the uninstall of previous version, but before the install of the new version is complete. This causes the upgrade to fail, and ends up with the program in a half-removed state. Program directories and shortcuts are gone, but it still exists within add/remove programs.

Here's relevant installer code

  <Product Id="*" Name="$(var.mmgr)" Language="1033" Version="$(var.BuildVersion)" Manufacturer="$(var.mfr)" UpgradeCode="{35DFF6FA-97CF-4461-8EE0-2F5EFE9F2DA7}">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" Manufacturer="$(var.mfr)" Description="$(var.mmgr)"/>

    <!-- UPGRADE INFORMATION -->
    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowSameVersionUpgrades="yes" Schedule="afterInstallInitialize"/>

<Property Id="WixShellExecTarget" Value="[INSTALLFOLDER]mmgr.exe" />
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
    <InstallExecuteSequence>
      <Custom Action="LaunchApplication" After="InstallFinalize">1</Custom>
    </InstallExecuteSequence>

I have also tried doing the upgrades via RemoveExistingProducts in InstallExecuteSequence, but no matter what I do with version numbers, it never uninstalls the old version. There's always a duplicate entry in add/remove programs.

Maybe it has something to do with the value in the LaunchApplication Custom? I have a 1 in there because other examples I've seen such as "NOT Installed" typically cause the install to fail every time. I'm missing something really simple here.

wix
upgrade
custom-action
asked on Stack Overflow Aug 16, 2019 by Ricky

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0