0

I currently have an application out in the field that was distributed as a .msi installer (Built with Wix). I've just finished porting this application over to Electron to take advantage of all of the latest and greatest features including using Electron Builder and Auto Updates.

Any wix/msi gurus know the best way I could uninstall the old msi and run the new installer? The solutions I have found involve searching through the Windows Registry to find the msi UUID then using msiexec.

Is it possible to just create a new version of the .msi that cleans up everything?

EL45
  • 470
  • 4
  • 16

1 Answers1

1

If I understand correctly you want to migrate from MSI to NSIS format? There is an article on this here: https://nsis.sourceforge.io/Uninstalling_a_previous_MSI.


I would suggest, however, that you find the product code for the MSI and invoke msiexec.exe with the product code and your own uninstall string (not the one gotten from the registry as shown in the above documentation). This way you can add a few constructs to prevent spontaneous reboot and to enforce proper silent running. This approach is described below.


Uninstall MSI: You can uninstall the previous MSI version by running an uninstall command in any number of ways: Uninstalling an MSI file from the command line without using msiexec.

Find Product Code: You can find the product GUID of the MSI as follows: How can I find the product GUID of an installed MSI setup?

Command Line: Combining approach 3.5 from first link above and the product code found using the information in the second link, you can use a command line like this to invoke from your NSIS installer:

msiexec.exe /x {11111111-1111-1111-1111-11111111111X} /QN /L*V "C:\msilog.log" REBOOT=ReallySuppress

Quick Parameter Explanation:

/X = run uninstall sequence
{11111111-1111-1111-1111-11111111111X} = product guid of app to uninstall
/QN = run completely silently
/L*V "C:\msilog.log"= verbose logging at path specified
REBOOT=ReallySuppress = prevent unexpected reboot of computer

ExecWait: NSIS requires its own peculiar command format: Running MSIEXEC in a NSIS script with installer switches. Haven't tested this yet, but a suggestion:

StrCpy $R0 "{11111111-1111-1111-1111-11111111111X}";  the MSI's ProductID of my package
ExecWait '"msiexec.exe" /x $R0 /QN REBOOT=ReallySuppress'

Check here for fine-tuning the command line: https://nsis.sourceforge.io/Uninstalling_a_previous_MSI.


Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Awesome. Thank you. You found a lot more information than I was able to. – EL45 Mar 05 '19 at 17:21
  • Great that it worked, did you have to make any tweaks to the **`ExecWait`**? I will update the answer "inline" if so. Apologies for the "information overload" - it always happens when trying to make an answer "re-usable". – Stein Åsmul Mar 05 '19 at 17:38
  • The `ExecWait` command worked perfectly. I ended up using `Exec` in order to let the installation finish without needing to wait for the old application to be uninstalled. Thanks again, this was a perfect answer. – EL45 Mar 06 '19 at 04:48