How to Create the Smallest Installation File Possible

If I had a dollar for every time I have been asked the following question:

“How do I create the smallest setup.exe possible in InstallShield?”



Therefore, in this post, I will talk about how to do just that.

Generally, people want a small footprint installation file because their product is downloadable from their company’s website. There are other reasons, but they are not important. How to do it is what’s important.

To get a small installer file, you need to look at two things, redistributables and compression. Let’s look at each of these.

When you create a release in the Release Wizard, or manually in the Releases view, you can either choose to Compress all files or Leave files uncompressed and separate from the installation package. Check out the screenshot below.

Release Configuration page in the Release Wizard

Release Configuration page in the Release Wizard



The screenshot above shows where I have selected the SINGLE_EXE_IMAGE release in the Releases View, and I have the Release Wizard open to the Release Configuration page. Obviously, since this is a Single Exe release, I have chosen Compress all Files. That’s the easy part of getting a small installer file.

The redistributables aspect is little more complicated in that it involves more possibilities and choices. First, let’s revisit the Redistributables view.

In the Redistributables view of an InstallShield project, there is a collection of prerequisites, merge modules and objects. One or more can be added to your project. In fact, you can have any combination of prerequisites, merge modules and objects.

Prerequisites can be installed by the Setup.exe bootstrapper or can be installed after feature selection, during the main installation.

Merge Modules are generally installed during the main installation. But I swear I have sometimes seen them being installed while the Preparing to Install dialog is displayed.

InstallShield Objects are always installed during the main installation.

Have a look at the next screenshot.

Redistributables view in an InstallShield project

Redistributables view in an InstallShield project



The screenshot above shows the Redistributables view and as you can see, there are a variety of Prerequisites, Merge Modules and Objects available.

With Merge Modules and Objects added to a Single Exe release (Setup.exe), you don’t have a choice. These redistributables will be compressed into your single Setup.exe file. However, with Prerequisites, you do have a choice.

Take a look at the screenshot below:

Prerequisites come in two types

Prerequisites come in two types



The .NET 4.0 prerequisite I have marked with a 1 is a full prerequisite. That means the entire .NET Framework 4.0 prerequisite is going to be compressed into your Single Exe file. Of course, this will result in a bigger file.

The .NET 4.0 prerequisite I have marked with a 2 is a web download prerequisite. That means .NET 4.0 won’t be compressed into your Single Exe, but instead downloaded from the Microsoft website during your product’s installation. When you choose web download prerequisites, the end result is a much smaller installation file.

At this point, you may be thinking that you will just always choose the web download version of a prerequisite. The problem is that not all prerequisites have both full and web download versions. So, what do you do? Well, don’t give up yet. There is still hope.

Check out the screenshot below.

InstallShield Prerequisites Location property

InstallShield Prerequisites Location property



In the screenshot above, I am back in the Releases view, I have again selected the Single Exe release and have clicked the Setup.exe tab. Now, look at the InstallShield Prerequisites Location property. I have set it to Download From The Web.

When you use Download From the Web, all of the InstallShield prerequisite files included in your project will be downloaded from the web, if it is necessary. Obviously, if a prerequisite is already installed on a user’s machine, it won’t be installed again.

To continue, each individual prerequisite will be downloaded from the URL specified in the InstallShield prerequisite (.prq) file for each prerequisite. This option overrides the locations specified in the Redistributables view for each InstallShield prerequisite’s properties.

You should now have all the information you need to produce the smallest Setup.exe file possible. To summarize, here’s what you need to do:

  1. Create a Single Exe release that includes Setup.exe
  2. Choose Compress all files on the Release Configuration page of the Release Wizard.
  3. When possible, choose Prerequisites instead of Merge Modules or Objects.
  4. In the Releases view, select your Single Exe release, click the Setup.exe tab and set the InstallShield Prerequisites Location property to Download From The Web.

Now you know what to do in order to get the smallest installation file possible.