赞
踩
VNISEdit 支持轻狂
https://www.flighty.cn/html/soft/20100429_76.html
软件协议
https://www.tecmz.com/article/license
详细介绍:使用NSIS和VNISEdit制作一个安装包,学来不亏,建议收藏!
https://blog.csdn.net/weixin_46847476/article/details/105537269
var code = “820b738d-7755-49eb-8998-1e8c32e21844”
说明:因为每次安装的时候,需要卸载之前的旧版本,但需要保留一些用户的软件配置文件。
所以,添加了卸载方法。
特别注意:这样设置,能确保卸载完了,再进行安装。否则出现装完了,又弹出卸载的对话框了。
IfFileExists '$INSTDIR\Uninst.exe' 0 +2
ExecWait '$INSTDIR\Uninst.exe /S _?=$INSTDIR'
卸载的部分,手动将所有需要删除的文件列举出来了。
; 该脚本使用 HM VNISEdit 脚本编辑器向导产生 ; 安装程序初始定义常量 !define PRODUCT_NAME "CCCCC软件" !define PRODUCT_VERSION "1.0.0.2200317" !define PRODUCT_PUBLISHER "AAAAA公司" !define PRODUCT_WEB_SITE "https://geosun.com.cn/soft/detail/oMBZL298d" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\mesh.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" SetCompressor lzma ; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------ !include "MUI.nsh" !include "TextReplace.nsh" ; MUI 预定义常量 !define MUI_ABORTWARNING !define MUI_ICON "mesh.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" ; 欢迎页面 !insertmacro MUI_PAGE_WELCOME ; 许可协议页面 !insertmacro MUI_PAGE_LICENSE "licence.txt" ; 安装目录选择页面 !insertmacro MUI_PAGE_DIRECTORY ; 安装过程页面 !insertmacro MUI_PAGE_INSTFILES ; 安装完成页面 !define MUI_FINISHPAGE_RUN "$INSTDIR\mesh.exe" !insertmacro MUI_PAGE_FINISH ; 安装卸载过程页面 !insertmacro MUI_UNPAGE_INSTFILES ; 安装界面包含的语言设置 !insertmacro MUI_LANGUAGE "SimpChinese" ; 安装预释放文件 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ; ------ MUI 现代界面定义结束 ------ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "mesh-install-v1.0.0.2200317.exe" InstallDir "D:\CCCCC软件" InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString" ShowInstDetails show ShowUnInstDetails show BrandingText "CCCCC软件" Section "MainSection" SEC01 IfFileExists '$INSTDIR\Uninst.exe' 0 +2 ExecWait '$INSTDIR\Uninst.exe /S _?=$INSTDIR' SetOutPath "$INSTDIR" ; 是否覆盖文件 SetOverwrite off CreateDirectory "$SMPROGRAMS\CCCCC软件" CreateShortCut "$SMPROGRAMS\CCCCC软件\CCCCC软件.lnk" "$INSTDIR\mesh.exe" CreateShortCut "$DESKTOP\CCCCC软件.lnk" "$INSTDIR\mesh.exe" File /r "..\release\mesh-20220317\*.*" SectionEnd Section -AdditionalIcons WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateShortCut "$SMPROGRAMS\CCCCC软件\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" CreateShortCut "$SMPROGRAMS\CCCCC软件\Uninstall.lnk" "$INSTDIR\uninst.exe" SectionEnd Section -Post WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\mesh.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\mesh.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" SectionEnd /****************************** * 以下是安装程序的卸载部分 * ******************************/ Section Uninstall Delete "$INSTDIR\Uninst.exe" Delete "$INSTDIR\${PRODUCT_NAME}.url" Delete "$SMPROGRAMS\CCCCC软件\Uninstall.lnk" Delete "$SMPROGRAMS\CCCCC软件\Website.lnk" Delete "$DESKTOP\CCCCC软件.lnk" Delete "$SMPROGRAMS\CCCCC软件\CCCCC软件.lnk" RMDir "$SMPROGRAMS\CCCCC软件" RMDir /r "$INSTDIR\iconengines" RMDir /r "$INSTDIR\imageformats" RMDir /r "$INSTDIR\platforms" RMDir /r "$INSTDIR\styles" RMDir /r "$INSTDIR\translations" Delete "$INSTDIR\D3Dcompiler_47.dll" Delete "$INSTDIR\Qt5Core.dll" Delete "$INSTDIR\Qt5Gui.dll" Delete "$INSTDIR\Qt5Svg.dll" Delete "$INSTDIR\Qt5Widgets.dll" Delete "$INSTDIR\geos_c.dll" Delete "$INSTDIR\libEGL.dll" Delete "$INSTDIR\libGLESv2.dll" Delete "$INSTDIR\libgcc_s_dw2-1.dll" Delete "$INSTDIR\libstdc++-6.dll" Delete "$INSTDIR\libwinpthread-1.dll" Delete "$INSTDIR\main.ico" Delete "$INSTDIR\mesh.exe" Delete "$INSTDIR\opengl32sw.dll" Delete "$INSTDIR\triangle.exe" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true SectionEnd #-- 根据 NSIS 脚本编辑规则,所有 Function 区段必须放置在 Section 区段之后编写,以避免安装程序出现未可预知的问题。--# Function un.onInit MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "您确实要完全移除 $(^Name) ,及其所有的组件?" IDYES +2 Abort FunctionEnd Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从您的计算机移除。" FunctionEnd
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。