Msiexec:安装失败时自动回滚到以前的版本
在静默模式下使用 msiexec 安装 .MSI 文件时,是否可以使其自动化,以便在安装失败时回滚到以前的版本?假设安装时已经安装了较旧的应用程序版本。
When installing a .MSI file using msiexec in silent mode, is it possible to automate it such that on installation failure it rollbacks to the previous version? Assuming that on installation an older application version is already installed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,在安装失败时通过回滚来恢复旧的应用程序版本实际上是Windows Installer 的内置功能,但您需要正确配置才能使其正常工作根据您的要求。
如果您使用:1) 次要升级或2) 卸载旧版本的正确排序的主要升级,Windows Installer 回滚将按照您的请求进行操作成功更新所有文件后的版本。如果主要升级设置为在安装新版本之前卸载旧版本,则回滚不可用,因为卸载已经结束,因此如果新安装程序失败并回滚,则不会留下任何已安装的内容。
重要:为了使次要升级和主要升级中旧版本的后期卸载能够正常工作,必须 100% 准确地遵循所有 MSI 组件规则。
当考虑更新后卸载旧版本的重大升级时,您可以将其视为修补操作,而无需将更新打包为补丁。 Windows Installer 实际上会在新旧版本上运行差异,然后仅实施所需的更改,而应用程序的其余部分保持不变。根据应用程序结构和文件数量,安装速度也会显着加快。
后期主要升级也是一种防止配置文件在升级过程中恢复到其原始安装状态的方法。这是一个典型的问题,其中配置文件在安装后更改,在主要升级期间卸载,然后重新安装,给人的印象是它们已恢复,而实际上是重新安装的。
我之前写过Windows Installer 回滚。可能值得一读。
Yes, restoring the old application version via rollback upon an installation failure is actually a built-in feature of Windows Installer, but you need to configure things correctly to get it to work as you require.
Windows Installer rollback will work as you request if you use: 1) a minor upgrade or 2) a properly sequenced major upgrade that uninstalls the older versions after successfully updating all files. If the major upgrade is set to uninstall the old version before installing the new, the rollback is not available since the uninstall is already over, and the new installer will hence leave nothing installed if it fails and rolls back.
Important: For minor upgrades and for late uninstall of old version in major upgrades to work correctly, all MSI component rules must be followed 100% accurately.
When thinking about a major upgrade that uninstalls the old version after updating, you can view it as a patching operation without having the update packaged as a patch. Windows Installer will actually run a diff on the old and new version and then implement only the required changes, leaving the rest of the application untouched. Depending on the application structure and number of files, this can be significantly faster to install as well.
Late-sequenced major upgrades are also a way to prevent configuration files from being reverted to their original installation status during upgrades. This is a classic issue where config files are changed after installation, uninstalled during a major upgrade and then being reinstalled giving the impression that they are reverted, when they are actually freshly reinstalled.
I have written about Windows Installer Rollback before. Might be worth a read.
不,这是不可能的。 重大升级在安装新版本之前先卸载旧版本。因此,当新安装失败时,旧版本已被删除。
No, this is not possible. A major upgrade uninstalls the old version before installing your new one. So when the new install fails, the old version is already removed.
有一种可能性,但它涉及更改升级顺序,这并不总是一件容易实现的事情。 之后移动RemoveExistingProducts
您应该在 InstallExecute 操作http://msdn.microsoft.com/en-us/library/windows/desktop/aa371197(v=vs.85).aspx
There is a possibility but it involves changing the upgrade sequence which is not always an easy thing to achieve. You should move the RemoveExistingProducts after InstallExecute action
http://msdn.microsoft.com/en-us/library/windows/desktop/aa371197(v=vs.85).aspx