[wix-users] uninstall older InstallShield app

kurt.jensen at us.ophiropt.com kurt.jensen at us.ophiropt.com
Thu Aug 24 11:51:25 PDT 2017


Alan,

Ended up splitting the custom action into two parts – detect old version and ask user if they want to proceed, and uninstall old version in a deferred custom action in order to get elevated privileges.

First part worked great, second part never did work right on every test system.  Finally the decision was made to simply prevent the new install if the old software was present. It now displays a message saying the user has to uninstall the old before being allowed to install the new.

Kurt

From: Alan Sinclair [mailto:anadem at gmail.com]
Sent: Thursday, August 24, 2017 12:39 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Jensen, Kurt <kurt.jensen at us.ophiropt.com>
Subject: Re: [wix-users] uninstall older InstallShield app

Kurt

Did you figure out a solution for this?
I just posted a similar question to the list, about removing product installed with InnoSetup

regards
Alan


On Thu, Aug 3, 2017 at 8:31 AM, kurt.jensen at us.ophiropt.com<mailto:kurt.jensen at us.ophiropt.com> <kurt.jensen at us.ophiropt.com<mailto:kurt.jensen at us.ophiropt.com>> wrote:
Our original app was written using Borland C++ 5.02 and installed with InstallShield 6.31.  :)

Service wants us to uninstall the old app with a prompt for the user during installation of the new app.





Initially wrote a custom action to throw up a message box then use registry entries to uninstall the old app.  Custom action runs immediate because the user must approve removal of old app in order to install new app.



Tried debugging the custom action. No exceptions.  No errors.  No idea if anything ran or not. Old app not uninstalled.





Tried breaking custom action into two parts:



1) Determine if old app is installed, ask user if we can uninstall, return ActionResult.Failure if No, runs immediate

2) Uninstall old app using inform registry entries, runs deferred with Impersonate="no" to get elevated privileges(?)



Again, no exceptions, no errors, not uninstalled





What would be the best approach to:



1) Determine if the old app is installed

    a) Ask user to uninstall. quit if they answer No, uninstall old app if they answer Yes

2) Install new app.





TIA!



<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Product Id="*"
            Name="M200sUninstaller"
            Language="1033"
            Version="1.0.0.0"
            Manufacturer="Spiricon"
            UpgradeCode="ae5a9bfb-bd57-4dae-9174-edafc2faf6fa">
                                <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x86" />

                                <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
                                <MediaTemplate />

                                <Feature Id="ProductFeature" Title="M200sUninstaller" Level="1">
                                                <ComponentGroupRef Id="ProductComponents" />
                                </Feature>

    <Directory Id="TARGETDIR" Name="SourceDir">
                                                <Directory Id="ProgramFilesFolder">
        <Directory Id="SPIRICONDIRECTORY" Name="Spiricon">
          <Directory Id="APPLICATIONDIRECTORY" Name="M200sUninstaller" />
        </Directory>
      </Directory>
                                </Directory>

    <!--
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    Custom Actions
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    -->
    <Binary Id="$(var.CustomAction.M200s.x86.TargetName).CA.dll"
          SourceFile="$(var.CustomAction.M200s.x86.TargetDir)$(var.CustomAction.M200s.x86.TargetName).CA.dll"/>

    <CustomAction Id="M200sInstall"
                    BinaryKey="$(var.CustomAction.M200s.x86.TargetName).CA.dll"
                    DllEntry="CAInstall"
                    Impersonate="yes"
                    Execute="immediate" />
    <SetProperty Id="WixBundleUILevel" Value="[WIXBUNDLEUILEVEL]" Sequence="execute" Before="M200sInstall"/>

    <CustomAction Id="M200sUninstall"
                    BinaryKey="$(var.CustomAction.M200s.x86.TargetName).CA.dll"
                    DllEntry="CAUninstall"
                    Impersonate="no"
                    Execute="deferred" />
    <SetProperty Id="ApplicationDirectory" Value="[APPLICATIONDIRECTORY]" Sequence="execute" Before="M200sUninstall"/>
    <CustomAction Id="CustomActionData"
              Property="M200sUninstall"
              Value="ApplicationDirectory=[APPLICATIONDIRECTORY]"
    />
    <InstallExecuteSequence>
      <Custom Action="M200sInstall" After="InstallInitialize">NOT Installed</Custom>
      <Custom Action="M200sUninstall" After="M200sInstall">NOT Installed</Custom>
      <Custom Action="CustomActionData" Before="M200sUninstall"></Custom>
    </InstallExecuteSequence>


                                <ComponentGroup Id="ProductComponents" Directory="APPLICATIONDIRECTORY">
                                                <Component Id="ProductComponent">
        <File Source="$(var.ProjectDir)SilentUninstall.iss" Id="SilentUninstall.iss"  />
      </Component>
                                </ComponentGroup>

  </Product>
</Wix>
This message may contain confidential information of MKS Instruments, Inc. or its subsidiaries. If you are not the intended recipient and have received this message in error, then any use or distribution is prohibited. Accordingly, please notify me immediately by e-mail and delete this message. Thank you.

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

This message may contain confidential information of MKS Instruments, Inc. or its subsidiaries. If you are not the intended recipient and have received this message in error, then any use or distribution is prohibited. Accordingly, please notify me immediately by e-mail and delete this message. Thank you.


More information about the wix-users mailing list