karollo
karollo

Reputation: 595

WIX Toolset - uninstalling .exe file

I wrote Wix Setup program, that wraps PyTangoArchiving-7.3.2.win-amd64.exe file into into PyTangoArchivingInstaller.msi package. The installation procces is correct I think, in control pannel -> Programs I can see two additional programs installed: PyTangoArchiving-7.3.2.win-amd64.exe - the program I wanted to install and my wrapper - PyTangoArchivingInstaller.

But when I try to uninstall the application, only wrapper is being uninstalled and whole program (PyTangoArchiving-7.3.2.win-amd64.exe ) is still there, I have to uninstall it manually from Control Panel. Can sb help me with this?

Here is my code:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="PyTangoArchivingInstaller" Language="1033" Version="1.0.0.0" Manufacturer="test" UpgradeCode="PUT-GUID-HERE">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)\License.rtf"/>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"/>


    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate  EmbedCab="yes"/>  
    <UIRef Id="WixUI_InstallDir"/>   

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id='TempFolder'>       
          <Directory Id="INSTALLLOCATION" Name="MyApp" >
            <Component Id='MyComponent'   Guid='*'>
          <File Id="mysetup_exe" Source="PyTangoArchiving-7.3.2.win-amd64.exe" />
        </Component>        
        </Directory>
      </Directory>
    </Directory>
    <Feature Id="MainApplication" Title="Main Application" Level="1">
      <ComponentRef Id="MyComponent" />
    </Feature>
    <CustomAction Id="run_setup" FileKey="mysetup_exe" ExeCommand="/SP- /SILENT /SUPPRESSMSGBOXES /LANG=English 
                  /NOCANCEL /DIR=&quot;[INSTALLLOCATION]&quot;"
                  Execute="deferred" Impersonate="no"
                   Return="check" />

    <InstallExecuteSequence>
      <Custom Action="run_setup" Sequence='5401'>NOT Installed</Custom>
    </InstallExecuteSequence>
  </Product>
</Wix>

Upvotes: 0

Views: 2858

Answers (1)

Brian Sutherland
Brian Sutherland

Reputation: 4798

As a general comment, you shouldn't usually be running another exe from inside your MSI, especially if it is an install that shows up in add/remove programs. You should instead use a bootstrapper to chain together multiple installs and this is the preferred way to do what you are trying to do.


Since you run your setup_exe from a custom action, you also need a corresponding custom action to uninstall it.

It would basically be the same format as the one you use to install except with the uninstall command line arguments, whatever they may be.

You will need to schedule your uninstall custom action before the "RemoveFiles" standard action so that the setup exe still exists when you try to run the custom action. You should also condition this custom action with REMOVE~="ALL" AND NOT UPGRADINGPRODUCTCODE.

This approach will run into problems when you try to support upgrades with/without upgrades to the packaged exe install. It is highly suggested you use either the wix burn bootstrapper (bit of a learning curve) or one of the other available bootstrappers for multiple install installations. These would more robustly and correctly support two installs along with upgrades and uninstalls.

Upvotes: 1

Related Questions