Setup Best Practices

InstallShield 2016

Project • This information applies to the following project types:

Basic MSI
DIM
InstallScript MSI
Merge Module
MSI Database
MSM Database
Transform

InstallShield makes adhering to Setup Best Practices easier by alerting you to Best Practices violations while you are creating components in the Setup Design view and in the Component Wizard. By following these guidelines, you can create clean installations that distribute reusable components efficiently and avoid problems that result from file incompatibility.

When you are creating components in the Setup Design view, the Setup Best Practices Wizard monitors the files that you add to the components, alerts you when you have done anything that conflicts with Best Practices, and then gives you the opportunity to correct the action in the wizard. To turn off the wizard’s automatic scanning of your setup design, select Options from the Tools menu.

InstallShield checks for compliance with the following Setup Best Practices:

Setup Best Practices that InstallShield Monitors

Best Practice

Description

Components should not contain multiple .exe, .dll, .ocx, .chm, or .hlp files

Each component should contain only one portable executable file (an .exe, .dll, or .ocx file) or WinHelp file (.hlp file). Windows Installer components are designed such that all of the advanced settings and component settings, such as the GUID code, refer ideally to a single portable executable file or help file. Place other .exe, .dll, .ocx, and .hlp files into new components.

One reason for this rule is that, at run time, if the user chooses Repair for an installed product, Windows Installer checks for the existence of each installed component’s key file. If the key file is missing, Windows Installer reinstalls the missing component. Therefore, if a file that is not the key file of a component is missing, it may not be restored during repair mode.

Use merge modules

Merge modules contain all of the files, registry entries, and logic necessary to install a distinct piece of functionality. You should not distribute a file for which a merge module is available. Using merge modules also helps you comply with two related requirements—the Best Practice to avoid associating a file with more than one component and the Windows logo guideline not to ship any core components.

If the Best Practices monitoring option is enabled, the Setup Best Practices Wizard alerts you whenever you try adding to a component any file that is part of the merge modules that InstallShield provides.

You should also be aware of the following component creation Setup Best Practices, to which InstallShield does not automatically alert you:

Setup Best Practices for which InstallShield Does Not Automatically Provide Alerts

Best Practice

Description

Put a shortcut target in its own component

Any file that serves as the target for a shortcut requires its own component. That file must be the key file for the component.

Group other files into components

Organize all files that do not fall into any of the above categories in components according to the files’ requirements, such as a common destination folder or version checking.

Do not self-register files

Instead of calling self-registration functions to register and unregister COM server information, you should register this information for the component during installation (and the installer will unregister it during uninstallation).

Self-registration is an unreliable method for registering and unregistering files. One advantage of having the installation register the information is that if the file is advertised, or not immediately installed, the registration is in place when the file is later requested from the installer. Therefore, InstallShield supports advanced settings specifically for registering COM servers.

See Also