Msiexec: automatic rollback to previous version on installation failure

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.


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.


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

链接地址: http://www.djcxy.com/p/56274.html

上一篇: 媒体查询以横向模式区分桌面与iPad

下一篇: Msiexec:在安装失败时自动回滚到以前的版本