Uninstalling a previous MSI: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Wikipedia python library) |
m (Updated author and download links, and changed format of some pages.) |
||
Line 24: | Line 24: | ||
Joost N. | Joost N. | ||
Page author: anonymous | Page author: [[User:anonymous|anonymous]] |
Revision as of 12:34, 23 April 2005
Description
I migrated my software from an MSI installer to NSIS. Upon installing the new version of my software, I first needed to uninstall the previous MSI package. Here's how I did it:
== The Script ==
Function UninstallMSI ; $R0 should contain the GUID of the application push $R1 ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$R0" "UninstallString" StrCmp $R1 "" UninstallMSI_nomsi MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "A previous version of ${MUI_PRODUCT} was found. It is recommended that you uninstall it first.$\n$\n\Do you want to do that now?" IDNO UninstallMSI_nomsi IDYES UninstallMSI_yesmsi Abort UninstallMSI_yesmsi: ExecWait '"msiexec.exe" /x $R0' MessageBox MB_OK|MB_ICONINFORMATION "Click OK to continue upgrading your version of ${MUI_PRODUCT}" UninstallMSI_nomsi: pop $R1 FunctionEnd
From the main Section I then do the following:
push $R0 StrCpy $R0 "{48E5A72D-whatever-xxxx}"; the MSI's ProductID of my package Call UninstallMSI pop $R0
In my case I had to do this for every ProductID for each previous version of my application. Joost N.
Page author: anonymous