如何从 .msi 安装程序到 electron-builder (nsis)
How to go from .msi installer to electron-builder (nsis)
我目前在现场有一个应用程序作为 .msi 安装程序分发(使用 Wix 构建)。我刚刚将此应用程序移植到 Electron,以利用所有最新和最强大的功能,包括使用 Electron Builder 和自动更新。
任何 wix/msi 专家都知道卸载旧 msi 和 运行 新安装程序的最佳方法吗?我找到的解决方案包括搜索 Windows 注册表以查找 msi UUID,然后使用 msiexec。
是否可以只创建一个新版本的 .msi 来清理所有内容?
If I understand correctly you want to migrate from MSI to NSIS format?
There is an article on this here:
https://nsis.sourceforge.io/Uninstalling_a_previous_MSI.
不过,我建议您找到 MSI 的 产品代码 并使用该产品调用 msiexec.exe
代码和您自己的卸载字符串(不是上述文档中显示的从注册表中获取的字符串)。通过这种方式,您可以添加一些结构来防止 自发重启 并 强制执行适当的静默 运行。下面描述了这种方法。
卸载 MSI:您可以通过 运行 卸载命令以多种方式卸载以前的 MSI 版本: Uninstalling an MSI file from the command line without using msiexec.
查找产品代码:您可以找到MSI的产品GUID,如下所示:
命令行:结合上面第一个 link 中的方法 3.5 和使用第二个中的信息找到的产品代码link,您可以使用这样的命令行从您的 NSIS 安装程序调用:
msiexec.exe /x {11111111-1111-1111-1111-11111111111X} /QN /L*V "C:\msilog.log" REBOOT=ReallySuppress
快速参数说明:
/X = run uninstall sequence
{11111111-1111-1111-1111-11111111111X} = product guid of app to uninstall
/QN = run completely silently
/L*V "C:\msilog.log"= verbose logging at path specified
REBOOT=ReallySuppress = prevent unexpected reboot of computer
ExecWait:NSIS 需要它自己特殊的命令格式:Running MSIEXEC in a NSIS script with installer switches。尚未对此进行测试,但建议:
StrCpy $R0 "{11111111-1111-1111-1111-11111111111X}"; the MSI's ProductID of my package
ExecWait '"msiexec.exe" /x $R0 /QN REBOOT=ReallySuppress'
检查此处以微调命令行:https://nsis.sourceforge.io/Uninstalling_a_previous_MSI。
链接:
- https://nsis.sourceforge.io/Uninstalling_a_previous_MSI
- https://nsis.sourceforge.io/Auto-uninstall_old_before_installing_new
- How do I require user to uninstall previous version with NSIS
- https://nsis.sourceforge.io/Removing_MSI_packages_with_MSI_related_functions
我目前在现场有一个应用程序作为 .msi 安装程序分发(使用 Wix 构建)。我刚刚将此应用程序移植到 Electron,以利用所有最新和最强大的功能,包括使用 Electron Builder 和自动更新。
任何 wix/msi 专家都知道卸载旧 msi 和 运行 新安装程序的最佳方法吗?我找到的解决方案包括搜索 Windows 注册表以查找 msi UUID,然后使用 msiexec。
是否可以只创建一个新版本的 .msi 来清理所有内容?
If I understand correctly you want to migrate from MSI to NSIS format? There is an article on this here: https://nsis.sourceforge.io/Uninstalling_a_previous_MSI.
不过,我建议您找到 MSI 的 产品代码 并使用该产品调用 msiexec.exe
代码和您自己的卸载字符串(不是上述文档中显示的从注册表中获取的字符串)。通过这种方式,您可以添加一些结构来防止 自发重启 并 强制执行适当的静默 运行。下面描述了这种方法。
卸载 MSI:您可以通过 运行 卸载命令以多种方式卸载以前的 MSI 版本: Uninstalling an MSI file from the command line without using msiexec.
查找产品代码:您可以找到MSI的产品GUID,如下所示:
命令行:结合上面第一个 link 中的方法 3.5 和使用第二个中的信息找到的产品代码link,您可以使用这样的命令行从您的 NSIS 安装程序调用:
msiexec.exe /x {11111111-1111-1111-1111-11111111111X} /QN /L*V "C:\msilog.log" REBOOT=ReallySuppress
快速参数说明:
/X = run uninstall sequence
{11111111-1111-1111-1111-11111111111X} = product guid of app to uninstall
/QN = run completely silently
/L*V "C:\msilog.log"= verbose logging at path specified
REBOOT=ReallySuppress = prevent unexpected reboot of computer
ExecWait:NSIS 需要它自己特殊的命令格式:Running MSIEXEC in a NSIS script with installer switches。尚未对此进行测试,但建议:
StrCpy $R0 "{11111111-1111-1111-1111-11111111111X}"; the MSI's ProductID of my package
ExecWait '"msiexec.exe" /x $R0 /QN REBOOT=ReallySuppress'
检查此处以微调命令行:https://nsis.sourceforge.io/Uninstalling_a_previous_MSI。
链接:
- https://nsis.sourceforge.io/Uninstalling_a_previous_MSI
- https://nsis.sourceforge.io/Auto-uninstall_old_before_installing_new
- How do I require user to uninstall previous version with NSIS
- https://nsis.sourceforge.io/Removing_MSI_packages_with_MSI_related_functions