[wix-users] uninstall older InstallShield app

kurt.jensen at us.ophiropt.com kurt.jensen at us.ophiropt.com
Thu Aug 3 08:31:52 PDT 2017


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.


More information about the wix-users mailing list