Overview of Repackaging Best Practices

The installation repackaging process is based on monitoring file system and registry changes performed by the monitored installation as explained in the How Installation Repackaging Works chapter. Depending on the computer state before and during the repackaging process, you may obtain either correct or incorrect repackaging results. It is recommended that a special environment be used and the repackaging best practices explained below be followed to achieve correct repackaging results.

How to Create a Clean Environment for Monitoring

It’s important to use a clean environment for monitoring to prevent the appearance of any unwanted changes in the monitoring results. A clean environment doesn’t have any third-party software installed that can generate file system, registry and other OS changes that may appear in the monitoring results.

Follow the recommendations below to create a clean environment.

  • Use a fresh Windows installation. It’s recommended to use a brand-new Windows installation where no additional software is installed.
  • Disable an anti-virus, firewall and Windows updates. The system software running in the background may generate changes that will appear in the created package. To avoid that, it is recommended that Windows updates be disabled. An anti-virus, a firewall and other security software may also produce unwanted changes and might cause an unstable or incorrect monitoring operation, so they should be disabled as well.
  • Close all running programs. You need to close all running programs to avoid monitoring of the changes they produce.

Use Windows Sandbox for Monitoring

The simplest option to use a clean environment is monitoring in Windows Sandbox. Windows Sandbox is a part of Windows and it is available on Windows 10 or later OS. To use it you need to turn on virtualization capabilities in BIOS on your machine and enable Windows Sandbox in the list of Windows Features. Every time you run Sandbox, it runs a brand-new clean Windows that works in an isolated environment. This clean environment doesn’t require any setup, it is available immediately. A sandbox is temporary. When it's closed, all the software and files and the state are deleted.

Note that some software installations cannot be installed in Windows Sandbox, because Sandbox environment has some limitations comparing with the regular environment. If repackaged software fails to deploy in Sandbox, you can monitor it on a virtual machine.

Use a Virtual Machine for Monitoring

Using a virtual machine (VM) allows you to create a reusable clean environment for monitoring. A virtual machine can run a regular Windows environment that doesn’t have any limitations of Windows Sandbox, so it’s recommended to use a virtual machine (VM) for monitoring. When you use a VM, it is possible to create a snapshot of the machine and return to the same state repeatedly. To follow the repackaging best practices, you should create a VM, set up a clean environment there as explained above and make a snapshot of the clean VM state.

Recommended Repackaging Environment

Every time you need to perform monitoring, you should revert the VM to the snapshot with the clean state. The VM revert works quickly and allows you to use a clean environment for every repackaging operation.

To optimize the monitoring process, it’s recommended to use “online” snapshots. These snapshots are with running Windows and logged-on user, so you don’t have to start Windows on the VM and to log in manually every time you need to repackage an installation.

Depending on the used edition of EMCO MSI Package Builder and the monitoring environment selected in the program, there are different approaches to configuring and using a VM.

  • Use a VM for monitoring to monitor on the local machine. Configure the VM as explained above and install EMCO MSI Package Builder on the same VM to perform monitoring locally. In this case, you should run EMCO MSI Package Builder on the VM, perform repackaging and revert the VM to the clean state after repackaging. This is the only option available in the Professional edition of the program. In the Enterprise and Architect editions of the program it can be selected as the Monitor on This Computer option.
  • When you select the Monitor on an Existing Virtual Machine option (available in the Enterprise and Architect editions of the program), a VM is connected remotely by the program to perform monitoring. You can configure the VM as explained above and run EMCO MSI Package Builder on your machine and use the VM for monitoring.

You can benefit from the repackaging automation using the Monitor on an Existing Virtual Machine option available in the Enterprise and Architect editions of the program. In this case, the program automatically maintains the clean state of the VM. You can learn more about all advantages of this approach in the Selecting the Monitoring Environment chapter.

How to Perform Repackaging If You Don’t Have a Virtual Machine or Sandbox

Using a clean environment for repackaging is important to get correct repackaging results. The repackaging process can be simplified when you use a VM, because you can quickly and easily restore the clean VM state utilizing VM snapshots. Alternatively you can use Windows Sandbox that runs an isolated clean machine and doesn’t require any setup. If you plan to perform repackaging regularly, it’s strongly recommended to consider creating a VM.

If for some reason you cannot use a VM or Sandbox, you need to follow the repackaging best practices listed in the next section, as well as some additional steps, namely:

  • Close all running applications and processes. You should close all running applications and processes except EMCO MSI Package Builder before you start repackaging since they are not related to the repackaged installation and may cause changes that will appear in the repackaging results.
  • Uninstall the monitored application. If an installation you need to repackage is already installed, uninstall it with all its components and dependencies.

Note that even if these recommendations are complied with, the monitoring results may not be as precise as those produced in a clean environment.

Repackaging Best Practices

When repackaging installations, you should always keep in mind that it is strongly advised:

  • Use a clean environment. It’s important to use a clean environment for repackaging to prevent the appearance of any unwanted changes in the repackaging results. Use a VM for repackaging and create a clean repackaging environment as explained above.
  • Monitor and deploy on the same platform. When you deploy the same installation on different platforms (x86 and x64), it can create different resources, so you should monitor the installation on the same platform and, preferably, under the same OS that will be used for deployment of the package to be generated. If you need to deploy an installation on both the x86 and x64 platforms, you should create two separate packages for these platforms.
  • Prevent an auto-start of the repackaged application after its installation. When you use the Capture Installations option for monitoring, EMCO MSI Package Builder automatically starts monitoring before running the repackaged installation and stops monitoring when the installation is finished. Some installations prompt you to run the installed application as the final step of the deployment, which prevents EMCO MSI Package Builder from detecting the end of the installation and stopping the monitoring process at the right place automatically. You have to skip running the installed application in the course of the installation process. If the application starts automatically after the installation, just close it to notify EMCO MSI Package Builder of the end of the installation process.
  • Skip reboots. If the monitored installation requires a reboot, you should stop monitoring and generate a deployment package before rebooting.

Usually, repackaging problems are caused by non-compliance with one or more of the best practice recommendations, so if you get a deployment package that does not work properly, make sure you use a clean environment for repackaging and follow other best practices.