DoYouThinkHeSawUs
DoYouThinkHeSawUs

Reputation: 53

Using Wix 3.8, using Bundle how do Uninstall an ExePackage when the uninstaller is packaged up inside an exe installer?

I've looked around at several answers here on StackOverflow and I couldn't find exactly what I needed to resolve an issue I am currently facing

I'm using Wix 3.8 and Visual Studio 2008, and having created an XML deployment project the Bundle.wxs file looks like this.

Here's my Bundle.wxs file

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

    <Bundle Name="SomeCompanyBundle"
          Version="1.0.0.0"
          Manufacturer="Some Company"
          UpgradeCode="348d9d7c-6a37-44cd-8054-61b97777b5bd" 
          IconSourceFile="..\Some Company\logo_64.ico">

    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" >
      <bal:WixStandardBootstrapperApplication 
        LicenseFile="..\Some Company\license-agreement.rtf"
        LogoFile="..\Some Company\logo_64.png" />
    </BootstrapperApplicationRef>

        <Chain>
            <!-- TODO: Define the list of chained packages. -->
      <ExePackage Id="EXE_UsbDriversInstallerExe"
                  DisplayName="Driver Installer Executable" 
                  Compressed="yes"
                  Cache="yes"
                  PerMachine="yes"
                  Permanent="no"
                  Vital="yes"
                  SourceFile="..\Some Company\Drivers-Installer.exe"
                  InstallCommand="/SILENT=YES"
                  />


        <!-- More MsiPackages are used in real Bundle.wxs, but they aren't included in this question, because they are working on install and uninstall -->
    </Chain>
    </Bundle>
</Wix>

This creates a Bundle installation file, called SomeCompanyBundle.exe

I can install this bundle via the command prompt e.g. SomeCompanyBundle.exe /quiet /install i.e. no install GUI is shown.

The issue I have is on the Uninstall which is due to the limited command line options given by Drivers-Installer.exe (This is an old installer.exe file from a third party company that no exists)

The only options available are SILENT=(YES/NO) or LANG=(ENGLISH, SPANISH....).

This Drivers-Installer.exe doesn't allow an Uninstall action. It has an Uninstall.exe program bundled inside the Drivers-Installer.exe and this Uninstall.exe is only available upon successful installation of Drivers-Installer.exe

The Uninstall.exe, once installed, is always located in the full path c:\Program Files(x 86)\SomeThirdPartyCompany\Drivers-Installed\Uninstall.exe

So how do I run this Uninstall.exe, when I need to uninstall the SomeCompanyBundle.exe when I use command prompt to run SomeCompanyBundle.exe /quiet /uninstall

The solutions I have tried are:

1) UninstallCommand="SILENT=YES" ---- Did not work, due to the above.

2) CustomAction ----- Got confused about how to run the Uninstall.exe just on the Bundle uninstall action.

3) Played around with uil:DirectorySearch and util:RegistrySearch. Again I got confused about how to run the Uninstall.exe just on the Bundle uninstall action.

Any help with examples/explanation will be appreciated.

Cheers in advance.

Upvotes: 5

Views: 3045

Answers (1)

Brian Sutherland
Brian Sutherland

Reputation: 4798

Here's an interesting way you can do this. I did something similar where I have an install that, when installed, puts an "uninstall.exe" somewhere on the system that you run to uninstall the product.

Use a util:FileSearch for seeing if that product is installed.

<util:FileSearch 
    Id="UsbDriversDirSearch"
    Path="[ProgramFilesFolder]\SomeThirdPartyCompany\Drivers-Installed\Uninstall.exe"
    Result="exists"
    Variable="UsbDriversInstalled" />

You should also add a DetectCondition="UsbDriversInstalled = 1" to your EXE_UsbDriversInstallerExe <ExePackage> This will stop you from trying to double install this product.

Create a second <ExePackage>.

<ExePackage
    Id="EXE_UsbDriversUninstallerExe"
    DetectCondition="NOT WixBundleInstalled OR UsbDriversInstalled = 1"
    UninstallCommand="whatever the uninstall command is"
    SourceFile="[ProgramFilesFolder]\SomeThirdPartyCompany\Drivers-Installed\Uninstall.exe"
    PerMachine="yes"
    Cache="no"
    Compressed="no" />

So now you will always have the Uninstall.exe 'installed' and you can uninstall this ExePackage when uninstalling the bundle because it has an UninstallCommand.

Upvotes: 5

Related Questions