Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 416
Lucian Podereu Avatar asked Nov 16 '11 16:11

Lucian Podereu


People also ask

What is rollback in installation?

When the Windows Installer processes the installation script for the installation of a product or application, it simultaneously generates a rollback script and saves a copy of every file deleted during the installation.

What is MSI rollback?

A. When you install a Windows Installer (. msi) file, a script in the file specifies the actions that Windows Installer will perform. As each action is performed, the process that calls the Windows Installer file into action updates a rollback script and, if files are to be deleted, backs up those files.


2 Answers

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.

like image 161
Stein Åsmul Avatar answered Oct 07 '22 23:10

Stein Åsmul


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.

like image 43
rmrrm Avatar answered Oct 08 '22 01:10

rmrrm