InstallShield 2016
Project • This information applies to the following project types:
• | Basic MSI |
• | DIM |
• | InstallScript |
• | InstallScript MSI |
• | InstallScript Object |
• | Merge Module |
• | MSI Database |
• | MSM Database |
• | Transform |
A file’s reference count (also referred to as refcount) is the number of products on a target system that use the file. Reference counts help to ensure that if multiple products are sharing a file, the file remains on the target system until all of the products that share it are removed.
Reference counts for shared files are stored in the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs
Both Windows Installer–based projects and InstallScript-based projects include support for managing the reference counts for shared files. The functionality is slightly different, depending on the project type.
Behavior in Windows Installer–Based Installations
In Basic MSI, DIM, InstallScript MSI, Merge Module, MSI Database, MSM Database, and Transform projects, you can indicate that a key file is shared by selecting Yes for the Shared setting of the key file’s component. If the installation installs the key file and Yes is selected for the component’s Shared setting, a reference count is created in the registry—if it does not already exist—and incremented. During uninstallation of the key file, the reference count is decremented.
Windows Logo Guideline • Windows logo guidelines require that the reference count be incremented when installing shared files and decremented when uninstalling. Core component files (which they recommend you not install) should not be reference counted.
Behavior in InstallScript-Based Installations
In InstallScript and InstallScript Object projects, you can mark a component as shared. If the installation installs the component’s files and Yes is selected for the component’s Shared setting, a reference count for each file is created in the registry—if it does not already exist—and incremented. During uninstallation of the component, the reference count is decremented.
You can call the InstallScript function GetFileInfo with the FILE_SHARED_COUNT constant to determine an existing file’s reference count.
How to Mark a Component as Shared
To specify that a component’s key file (in a Windows Installer–based project) or that a component (in an InstallScript-based project) is shared:
1. | In the View List under Organization, click Setup Design (for installation projects only) or Components. |
2. | Select the component that you want to configure. |
3. | For the Shared setting, select Yes. |
Tip • One example of when you should always mark a component as shared is if its files are to be installed to a shared directory such as the System folder or the Common Files folder.
Note • Note that the installation increments any existing reference count for any file in a component regardless of whether you mark the component as shared. However, if no reference count exists, the installation does not create one unless you select Yes for this Shared setting.
InstallShield 2016 Help LibraryAugust 2016 |
Copyright Information | Flexera Software |