Best Practices of EXE to MSI Repackaging

This article provides an overview of main reasons why EXE to MSI repackaging may fail and gives recommendations how to avoid problems.

Repackaging of EXE to MSI can be an easy task if modern repackaging tool is used. Actually you don't need to be an expert in installation in order to convert legacy setup into MSI - you just have to follow steps of the original installation and repackaging tool can track performed changes and generate an MSI package automatically. But sometimes MSI packages created by this way may fail to work. Repackaging process is very sensitive and can be influenced by a number of external factors. In order to convert EXE to MSI successfully you have to follow few repackaging best practices.

Make Repackaging on a Clean PC

Repackaging tools track file system and registry changes in scope of the repackaging process to collect input data for MSI generation. These changes can be performed by running applications and system processes. To avoid appearing of unwanted changes in captured results it's recommended to close all applications during EXE to MSI repackaging except the monitored setup. Or it will be even better to make a repackaging on a clean PC that only has an operation system and service patches installed and don't have any third-party applications.

Why it is so important? Some applications can share DLL files, for example, MS Word and MS Excel use common files. If MS Word is installed on a PC it means that shared DLLs already installed there and when you will make MS Excel installation these files will be skipped to install. If you will make repackaging of MS Excel installation, captured changes will be incomplete (because they miss installation of shared DLLs) and produced MSI file will not work on the PC where MS Word isn't installed.

For a repackaging you can prepare a clean installation of the operation system, that includes only OS patches and have repackaging application installed. For example, you can use virtualization for this and make a repackaging on a virtual host, such as VmWare, for example.

Restore Clean PC Before Every Repackaging

There is no common standard for EXE installations, so they implement install and uninstall procedures on their own way. Some setup packages may not remove all installed files and registry entries on uninstallation. If you uninstall the application and then install it again those files that weren't removed on uninstallation will not be installed again. It means that monitoring result of the repeated installation will be incomplete.

To avoid problems with incomplete installations restore a clean PC state every time when you are going to make a repackaging. Uninstalling the application and then repackaging its installation can cause problems with missing resources in generated MSI.

Repackage EXE to MSI for Every Deployment Platform

Windows x86 and x64 platforms aren't reciprocally compatible. Installations created for x86 platforms can work on x64, but not vice a versa. Some installations in EXE format include a check that detects a platform and perform installation of required resources that can be different for x86 and x64. If you repackage such installation on x64 platform, MSI will include files for x64 that will fail to work if this MSI will be deployed on x86 platform.

Make EXE to MSI repackaging on the same platform where you need to install MSI. For example, if you need to install MSI to Windows 7 x64, make a repackaging on Windows 7 x64 as well. If you need to distribute MSI to different platforms, it's better to create different MSI packages. If platform architecture is compatible, deployment of package created on one platform and deployment to another platform (for example, installation of MSI prepared on XP x86 and deployment to Windows 2000 x86) can be successful, but it depends on used repackaging tool. For example, according to different tests it works for EMCO MSI Package Builder, but fails for other tools.

Cleanup Changes Before MSI Generation

Installation changes detected by repackaging tool may include unwanted data, so it's recommended to remove it before starting of MSI generation. Windows is a multi-task system that allow multiple application and system services to run in parallel. Even if you close all application while you make EXE to MSI repackaging, captured changes may include actions performed by Windows services that run on a background. These changes have no sense for the installation and can be removed.

Different repackaging tools have different repackaging mechanisms, described in the article How to Convert EXE to MSI Package, that influence how unwanted changes can be filtered. Unfortunately there are no effective way to filter unwanted changes for tools that use before and after snapshots comparison method to track changes, because there is no information available about processes that caused every change. But this information is available for tools that use real-time monitoring, so you can remove all changes performed by particular processes.

Freeware MSI Tools
  • Windows Installer XML (WiX) is a free toolset that allows to build MSI package from XML source code.
  • Orca is a free database table editor for creating and editing Windows Installer packages and merge modules.
Videos About Repackaging

YouTube videos is a good reference how to use EXE to MSI repackaging on practice.