我将我的软件从Wix安装程序迁移到NSIS。安装新版本的软件后,我首先需要卸载以前的Wix软件包(如果存在)。
从NSIS安装程序,在“欢迎”屏幕中单击“下一步”时,我正在检查以前的Wix包,如果它存在则卸载它。以下是我的代码片段:
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE RemovePrevVerFunction
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_LANGUAGE "English"
Function RemovePrevVerFunction
ReadRegStr $R0 HKLM "SOFTWARE\EMR\3.01.00" "InstallPath"
${If} $R0 != ""
MessageBox MB_OKCANCEL "EMR 3.01.00 is already installed. Remove the pervious version?" IDOK uninst
Abort
uninst:
ExecWait '"MsiExec.exe" /X{8ED262EE-FC73-47A9-BB86-D92223246881} /qn' ; /x is to uninstall and /qn is to uninstall it silently
${EndIf}
FunctionEnd
使用上面的代码,我可以卸载以前的版本。但我需要做更多的事情。
请帮帮我。