Overwriting Files and Components on the Target System

InstallShield 2012 Spring

At run time, Windows Installer considers the following questions when determining whether files should be overwritten on the target system:

Should the component be installed?
If the component should be installed, do its files need to be installed or updated?

The following sections explain how Windows Installer evaluates these questions.

Determining Whether a Component Needs to Be Installed

During costing, Windows Installer checks the key path of a component to determine if the component should be installed. If the component has a directory or ODBC key path, Windows Installer installs the component. In addition, if a registry key path is used for the component and both of the following conditions are true, Windows Installer installs the component:

No is selected for the Never Overwrite setting of the component.
The key path does not exist on the target system.

If one or both of those conditions are false for a component that has a registry key path, Windows Installer does not install the component at run time.

If a component has a key file instead of a key path, Windows Installer checks the target system for the presence of that file. Windows Installer installs the component in all of the following scenarios:

The file is not present on the target system.
The file is present on the target system, and the key file of the component has a higher or equal version number compared to the version number of the file on the target system.
The file is present on the target system, and the key file of the component and the file on the target system are unversioned.

If the key file of the component has a lower version number than the file on the target system, Windows Installer does not install the component at run time. In addition, Windows Installer does not install the component at run time if the key file of the component is unversioned but the file on the target system is versioned. Thus, Windows Installer does not install a component if its key file could be downgraded at run time.

Determining Whether a File Needs to Be Installed

If Windows Installer determines that a component needs to be installed, it reviews the files for that component and determines if they need to be installed. If the name and target location of the key file matches the name and location of a file on the target system, Windows Installer uses the following rules by default to determine whether the file in your installation should overwrite the corresponding file on the target system:

Always Overwrite—If the Always Overwrite check box for the file is selected, the file on the target system is overwritten, regardless of version number.
Versioned Files—In all cases, the file with the highest version is maintained, even if the file already on the target system has a higher version than the one being installed. Additionally, a file of any version is maintained over unversioned files.
File Language—All other things being equal, the file that is the same language as the installation is maintained over different language versions of the file. The only exception to this rule applies to multiple language files. Files with multiple languages are maintained over single language versions of a file.
Date—If the modified date of a file already present on the target system is later than the creation date of that file, the file is not overwritten. This rule protects user preference files from being overwritten during an upgrade or reinstallation.

If a file is in the component that is being installed but it is not present on the target system, Windows Installer always installs that file.

Note: The REINSTALLMODE property can be set to modify the default file-versioning rules. For more information, see Understanding File Overwrite Rules.

See Also