Search code examples
mfcwixuninstallationredistributable

Wix - Uninstall another product another context, redistribute MFC


We want to have an installer A which must :

  • Remove another product B (we know its product guid)
  • redistribute MFC 2008, 2010 and 2012
  • write registry entries in HKLM

B is installed per-user. Since in our current implementation A redistributes MFC using merge modules, it installs per-machine. Therefore MajorUpgrade with same upgrade code doesn't work. We also tried running the script "msiexec /x {PRODUCT GUID OF B} /q" as a custom action during installation of A, but Windows has a mutex (_MSIExecute) that allows only one execute sequence per machine; therefore this idea doesn't work too.

Our ideas are now :

  1. redistribute MFC using another way than merge modules, and install A per-user (even if it writes in HKLM, yes I know it's bad practice, but it is simple to implement)
  2. implement the installer of A as a bootstrapper/chainer (and therefore the installer of A will be a file like setup.exe) and run the uninstall command after execution of MSI

What are you suggestions ?


Solution

  • Finally I found a solution :

    • Write a program (in C# .Net 3.5 for example) which will install A. If this install succeed, we uninstall B. Also we are sure that C# .Net 3.5 is installed on our customer's machine.
    • "Wrap" the above program and the msi using iexpress. The output will be a self extracting .exe file, which will execute the above program. We deliver this file to the customer.