You are on page 1of 6

Setting Component Key Files

InstallShield 2011

Project
This information applies to the following project types:

Basic MSI InstallScript MSI Merge Module MSI Database MSM Database Transform

Task
To specify one of your components files as the key file: 1. 2. 3. In the View List under Organization, click Setup Design (in installation projects only) or Components. In the explorer, expand the component and click Files. Right-click in the files list and click Set Key File. The file icon ( key icon ( ). ) for that file is replaced with a

A component can have either one key file or one key path. If you have already set a key file or a key path for a component, a warning message box appears if you try to set another key file. Click Yes in the message box to replace the existing key file or key path with the new key file.

Note
You cannot specify a key file in the Files and Folders view. Key files must be set in either the Setup Design or Components view.

See Also
Setting Key Paths for Components Overwriting Files and Components on the Target System

Overwriting Files and Components on the Target System


InstallShield 2011 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 OverwriteIf the Always Overwrite check box for the file is selected, the file on the target system is overwritten, regardless of version number. Versioned FilesIn 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 LanguageAll 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. DateIf 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
Checking File Versions Before Installing Setting Component Key Files File Versioning Rules

(Windows Installer Help Library)

Understanding File Overwrite Rules


InstallShield 2011

Project
This information applies to the following project types:

Basic MSI InstallScript MSI

The Windows Installer service uses several file overwrite rules, by default, to determine whether a file included in an upgrade should overwrite a file that already exists on the target system. The rules apply when theREINSTALLMODE property uses the o setting to install over older files on the target system. To change this behavior, you can replace the o option with one of the following values:

pReinstall eReinstall dReinstall aReinstall

only if there is no equivalent file on the target system. if the file is missing or if it is an earlier or equal version. if file is missing or different. all files, regardless of version.

Note that the setting for REINSTALLMODE applies to all of the features being installed; it cannot be set for an individual feature. In addition, setting REINSTALLMODE to include a will likely cause prompts for the original installation source during the application of a patch.

See Also
Overwriting Files and Components on the Target System File Versioning Rules (Windows Installer Help Library) REINSTALLMODE Property (Windows Installer Help Library)

File Versioning Rules


At the core of any installer is the actual installation of files. Determining whether to install a file is a complex process. At the highest level, this determination depends on whether the component to which a file belongs is marked for installation. Once determined that a file should be copied, the

process is complicated if another file with the same name exists in the target folder. In such situations, making the determination requires a set of rules involving the following properties: Version Date Language

The installer only uses these rules when trying to install a file to a location that already contains a file with the same name. In this case, the Windows Installer uses the following rules, all other things being equal, to determine whether to install. Highest Version WinsAll other things being equal, the file with the highest version wins, even if the file on the computer has the highest version. Versioned Files WinA versioned file gets installed over a nonversioned file. Favor Product LanguageIf the file being installed has a different language than the file on the computer, favor the file with the language that matches the product being installed. Language-neutral files are treated as just another language so the product being installed is favored again. Mismatched Multiple LanguagesAfter factoring out any common languages between the file being installed and the file on the computer, any remaining languages are favored according to what is needed by the product being installed. Preserve Superset LanguagesPreserve the file that supports multiple languages regardless of whether it is already on the computer or is being installed. Nonversioned Files are User DataIf the Modified date is later than the Create date for the file on the computer, do not install the file because user customizations would be deleted. If the Modified and Create dates are the same, install the file. If the Create date is later than the Modified date, the file is considered unmodified, install the file. The installation of a Companion File depends not on its own file versioning information, but on the versioning of its companion parent. In the case of Companion Files, the installation is skipped only if the parent file has a higher version. Note that a file that is the key path for its component must not be a companion file because this results in the versioning logic of the key path file being determined by the companion parent file. Nonversioned Files Using Companion Files-A nonversioned file that is associated with a versioned file using the companion mechanism abides by the rules for the versioned file. The only exception is if the versioned file on the computer and the versioned file being installed have the same version and language but the companion file is missing on the computer. In this case the companion file being installed is used even though the versioned file on the computer is used. Additionally, a nonversioned file using a companion file is installed if the REINSTALLMODE property includes the overwrite older versions options ("o" or "e") and the companion file's version is equal to a file already on the machine. Rules are GlobalThe rules for determining when to install a file reside in one place within the installer and are global, meaning they apply to all files equally. For examples of the format used for file versions, see the Version data type. For more specific information, see Replacing Existing Files or Default File Versioning.

http://msdn.microsoft.com/en-us/library/Aa371182

REINSTALLMODE Property
The REINSTALLMODE property is a string that contains letters specifying the type of reinstall to perform. Options are case-insensitive and order-independent. This property should normally always be used in conjunction with the REINSTALL property. However, this property can also be used during installation, not just reinstall. Note The Windows Installer ignores the REINSTALLMODE property during an administrative installation.

Reinstall Option Codes


By default the REINSTALLMODE is "omus".

Code Option
p o e d c a u Reinstall only if the file is missing. Reinstall if the file is missing or is an older version. Reinstall if the file is missing, or is an equal or older version. Reinstall if the file is missing or a different version is present. Verify the checksum values, and reinstall the file if they are missing or corrupt. This flag only repairs files that the Attributes column of the File Table. Force all files to be reinstalled, regardless of checksum or version. Rewrite all required registry entries from the Registry Table that go to the

HKEY_CURRENT_USER
or

HKEY_USERS
registry hive. m Rewrite all required registry entries from the Registry Table that go to the

HKEY_LOCAL_MACHINE
or

HKEY_CLASSES_ROOT

registry hive. Rewrite all information from the Class Table, Verb Table, PublishComponent Table, ProgID Table Table, and AppID Table regardless of machine or user assignment. Reinstall all qualified components.

When reinstalling an application, this option runs the RegisterTypeLibraries and InstallODBC actions
s v Reinstall all shortcuts and re-cache all icons overwriting any existing shortcuts and icons.

Use to run from the source package and re-cache the local package. Do not use the v reinstall option code for feature.

If the REINSTALLMODE property is defined without also defining the REINSTALL property, then the specified "detection" modes still apply and specify the "overwrite" mode for a normal installation. The REINSTALLMODE property only affects those features that are selected normally for installation. The presence of the REINSTALLMODE property does not reinstall features. The reinstallation of features requires the presence of the REINSTALL property. The option codes for this property correspond to the command-line option '/f'. The command-line option has a default value of 'pecms'. Note Only those files containing checksum information are ever verified and repaired. The REINSTALLMODE_FILEVERIFY flag (the ccode above) only repairs files that have msidbFileAttributesChecksum in the Attributes column of the File Table.

You might also like