Registry Key attributes

Reference information
Project page Registry Keys and Values
Related topics Working with attribute panes

Introduction

A Registry Key object represents a registry key for installation or removal. You can add or remove keys, and you can optionally remove all their subkeys and values as well.

Installation or removal of a registry key is controlled by its component. If the component is installed, the registry key's Install action is executed (which may actually remove the key); if the component is removed, the Remove action is executed. If a registry key is not linked to a component, its Install action is executed during installation of your product, and its Remove action when the product is removed.

In addition to the explicit installation and removal actions, registry keys are automatically created if a subkey or value is installed under the key, and removed if they become empty (unless Remove action is set to Do not remove).

MSI note Windows Installer requires that all registry keys with actions other than Create on demand and Remove if empty are linked to components; Tarma ExpertInstall will issue a BLD:E0072 diagnostic message if this is not the case.

Installation actions

The installer can create or remove the registry key and its values during product installation. The effect of the actions differs somewhat between Tarma Installer and Windows Installer, because Windows Installer does not support the full complement of installation actions.

Note: As a side effect, removal of a key may lead to removal of its parent key if the key is empty after the key is removed. This in turn may lead to removal of the grandparent key, etc.

Install action Tarma Installer Windows Installer

Create on demand

The registry key is created, if it does not already exist, when its first value or subkey is installed. Same
Create always The registry key is created if it does not already exist, regardless of any values or subkeys under it. Same
Remove if empty If the registry key exists but has no values or subkeys, it is removed. If it contains one or more values or subkeys, it is left as-is. Not supported. Behaves as Create on demand (for safety reasons).
Remove key and values If the registry key exists, its values (but not subkeys) are removed. If it contains no subkeys, the key itself is then removed. If it does contain one or more subkeys, the registry key is retained (but its values are gone).
Remove key and subkeys If the registry key exists, its values and all of its subkeys are removed recursively, then the key itself is removed. Same

Removal actions

The installer can remove or retain the registry key during product removal. The effect of the actions differs somewhat between Tarma Installer and Windows Installer, because Windows Installer does not support the full complement of removal actions.

Note: As a side effect, removal of a key may lead to removal of its parent key if the key is empty after the key is removed. This in turn may lead to removal of the grandparent key, etc.

Remove action Tarma Installer Windows Installer
Do not remove The registry key is left as-is. Not supported. Behaves as Remove if empty.
Remove if empty If the registry key exists but has no values or subkeys, it is removed. If it contains one or more values or subkeys, it is left as-is. Same
Remove key and values If the registry key exists, its values (but not subkeys) are removed. If it contains no subkeys, the key itself is then removed. If it does contain one or more subkeys, the registry key is retained (but its values are gone). Not supported. Behaves as Remove if empty.
Remove key and subkeys If the registry key exists, its values and all of its subkeys are removed recursively, then the key itself is removed. Same

Warning Registry key removal warning

Removing a non-empty registry key is potentially a dangerous operation, even more so if its subkeys are also removed. During the removal process, all values under the key (and potentially under its subkeys) are removed regardless of their installation status. This may cause serious problems on the target system. If at all possible, you should selectively remove registry values by using registry value installation and removal actions (see Registry Value).

Attributes

This pane contains the following attributes and options.

Attribute Description
Key name Enter the name of the registry key. You may use symbolic references in the name; they will be resolved when the registry key is installed.
Alias Enter the alias for the registry key. This alias must be unique in the project; it is used as a key in the Windows Installer database. Tarma Installer uses the alias as if it were a symbolic variable; for example, you can use expressions like <@regkey_alias\value> to retrieve registry value data during installation. This is not supported by Windows Installer.
Install action Select the desired installation action from the drop-down list. The installation action is executed when the registry key's component is installed. If the registry key is not linked to a component, the action is executed when the product as a whole is installed. See Installation actions above for the full list of actions.
Remove action Select the desired removal action from the drop-down list. The removal action is executed when the registry key's component is removed. If the registry key is not linked to a component, the action is executed when the product as a whole is removed. See Removal actions above for the full list of actions.