diff --git a/packages/windows/nsis_hooks.sh b/packages/windows/nsis_hooks.sh new file mode 100644 index 00000000..2cd2df9a --- /dev/null +++ b/packages/windows/nsis_hooks.sh @@ -0,0 +1,5 @@ +!define NSIS_HOOK_PREUNINSTALL "NSIS_HOOK_PREUNINSTALL_" + +!macro NSIS_HOOK_PREUNINSTALL_ +ExecWait '"$INSTDIR\uninstall-service.exe"' +!macroend diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index 84047f1b..bf46ee2d 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -16,7 +16,8 @@ "installerIcon": "icons/icon.ico", "languages": ["SimpChinese", "English"], "installMode": "perMachine", - "template": "./template/installer.nsi" + "template": "./template/installer.nsi", + "installerHooks": "../packages/windows/nsis_hooks.sh" } } },