[英]Create more than 1 uninstaller in a NSIS Section
Can a NSIS Section create more than 1 uninstaller? NSIS部门可以创建多个卸载程序吗?
My installer can install plugins for 3 different versions of an Application - therefore theres 3 different directories where the installer will install the files. 我的安装程序可以为3个不同版本的应用程序安装插件-因此,安装程序将在3个不同的目录中安装文件。
In each of those directories I want to add an uninstaller file that will remove only the files in that directory. 我要在每个目录中添加一个卸载程序文件,该文件将仅删除该目录中的文件。
Each of the 3 uninstall files are created within the same Section area, is this invalid? 3个卸载文件中的每一个都在相同的Section区域中创建,这是否无效? How can I get my script to create 3 uninstallers(if possible)? 如何获得创建3个卸载程序的脚本(如果可能)?
The following Section only creates one uninstaller, the last one(Version 10 uninstaller): 以下部分仅创建一个卸载程序,最后一个(版本10卸载程序):
Section "Install Plugin Files" MainSetup
CheckInstallVers8:
IntCmp $installVers8 1 InstallVersion8 CheckInstallVers9 InstallVersion8
CheckInstallVers9:
IntCmp $installVers9 1 InstallVersion9 CheckInstallVers10 InstallVersion9
CheckInstallVers10:
IntCmp $installVers10 1 InstallVersion10 MainInstallation InstallVersion10
InstallVersion8:
# install plugins...
SetOutPath $VERS8DIR
writeUninstaller "${APPNAME} Uninstall.exe"
GoTo CheckInstallVers9
InstallVersion9:
SetOutPath $VERS9DIR
writeUninstaller "${APPNAME} Uninstall.exe"
GoTo CheckInstallVers10
InstallVersion10:
SetOutPath $VERS10DIR
writeUninstaller "${APPNAME} Uninstall.exe"
SectionEnd
You can call WriteUninstaller as many times as you want but you should use the full path name ( writeUninstaller "$VERSxDIR\\${APPNAME} Uninstall.exe"
) 您可以根据需要多次调用WriteUninstaller,但应使用完整路径名( writeUninstaller "$VERSxDIR\\${APPNAME} Uninstall.exe"
)
You did not post a full script so it is hard to tell what is wrong with the logic (You might want to use LogicLib.nsh so you can do {IF}
s) but you should be able to "MessageBox debug" your way to the solution. 您没有发布完整的脚本,因此很难说出逻辑出了什么问题(您可能希望使用LogicLib.nsh来执行{IF}
),但是您应该能够“ MessageBox debug”解决方案。
One thing you did not talk about that might be relevant is the uninstaller logic. 您没有谈论过的一件事可能是相关的,即卸载程序逻辑。 If the 3 uninstallers all do the exact same task then this is not an issue but I'd expect at least a difference in the uninstaller registry registration. 如果3个卸载程序都执行完全相同的任务,那么这不是问题,但我希望至少在卸载程序注册表注册方面有所不同。
There are two ways to deal with this: 有两种方法可以解决此问题:
File
s 使用!system调用makensis.exe并在编译时生成常规File
包含的卸载程序 A different solution that might be relevant for plugins in sub-directories is to use a component page in the uninstaller and only delete the uninstaller when all 3 plugins have been removed... 可能与子目录中的插件相关的另一种解决方案是在卸载程序中使用组件页面,并且仅在删除所有3个插件后才删除卸载程序...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.