To change your product’s installation package from a setup.exe to msi requires the un-installation and re-installation of your product, thereby losing all your configurations.
There is no upgrade path available when moving from exe to msi. With lots of installer frameworks available for developers, providing an upgrade path becomes a serious concern when shifting to a standard installation framework like Windows Installer.
This article proposes a method wherein the end user can upgrade to the new version though the install engine used is different from the one used to install the previous version. It provides the following advantages to the end user:
- Easy migration of the product from a setup.exe install engine to Windows Installer
- Retaining configuration which gets lost on uninstall-reinstall procedure
- Minimized User time/effort by performing an upgrade
- Assumptions:- Setup.exe is build using Installshield IDE.
While upgrading from a third party installation framework to Windows installer proposes a series of steps(optional, depending on the installer functions and install engine from which the upgrade is happening) that are to be performed in sequence. The steps should be incorporated into the source file of the MSI(new version of the product).
The steps are described below:
- Check if upgrade is possible.
- Populate install directory
- Export Configuration registry entries/keys created by the product into a back up file
- Upgrade to an intermediate version of the product which can read the log files created by the older version and store it into a text file.
- Uninstall the product with the uninstall string
- Ensure the uninstallation has not marked files in use for deletion on reboot.
- Read the text file and assign public property values for the new installation
- Import the back up files created in Step 3 into application’s configuration registries.
The steps mentioned above ensure:
- Configuration Information is retained. Configuration Information includes setting environment variables, changing Ini Files, registry settings, modifying XML files, ODBC settings etc.
- User selection from the previous installation is acquired for upgrade. It includes all UI properties and public properties required for installing the new version
- New files are copied and old files are deleted.
Taking an example of providing an upgrade path from Installscript based installation (Setup.exe) to Windows Installer (MSI).
- Step 1: The UninstallString registry entry in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<pdt-guid> helps in detecting if a fresh install or an upgrade should happen. The presence of UninstallString is an indication that an upgrade should happen.
To ensure if upgrade is possible, the information retained by the previous installation/upgrade in order to perform native upgrade is required. The information can be in the form of XML, log files, registries etc. If the required data is not present, terminate upgrade. In case of Installscript, the required information is in setup.ilg file in %programfiles%\InstallShield Installation Information\<pdt-guid>. The setup.ilg file is essential to retrieve the installation properties of the previous install. Upgrade proceeds only if the .ilg file is available.
- Step 2: Populate the install directory from a configuration entry set by previous installer. This step is required when the install directory cannot be obtained through the native log file.
- Step 3: Application generated configuration information will be available in registry entries. User’s preferences/settings set through the application should be backed up. If registry entries hold configuration info, then export them. If the preferences are part of ini files or xml files, backup the information in a separate file.
- Step 4: Upgrade to an intermediate version of the product. The intermediate version’s installer will not install new files or make any changes to the existing installation except incrementing the version. The main function of the intermediate installer is to read the setup.ilg file and write installation information into a file readable by the new installer. The setup.ilg file can be read only by an installer with the same product code. The intermediate installer should be developed for the third party installation framework. An intermediate upgrade is performed to acquire the installation properties for the MSI install.
- Step 5: Using the UninstallString acquired in step 1, the product is uninstalled through a Custom Action or function.
- Step 6: Remove files installed by the product from PendingFileRenameOperations registry entry if the uninstallation in Step 5 has marked files in use for deletion on reboot. This step ensures that the new files after upgrade will not be deleted on reboot.
- Step 7: From the text file created in Step 4, public properties should be set. The installer proceeds like a normal installation with the properties specified in the text file. Install settings are hence restored.
- Step 8: After the installation is over, the configuration information/preference set through the application is restored using the backup file created in Step 3.
Hence the steps mentioned above helps you move to a standard Windows installation from setup.exe. The same approach can also be followed if you have used some other IDE for building the setup.exe, provided you have the path of the file which initially logs(in this case the .ilg file) all the configuration.