Registry Element

WiX Help

Registry Element

Description

This element allows you to add or remove registry keys (depending upon the value of the action attribute). Please note that for removal, there are 4 options: you can remove a particular registry name, an entire registry key when the parent component is installed, an entire registry key when the parent component is uninstalled, or create a key when the parent component is installed, then remove it when the parent component is uninstalled.

Windows Installer references
Registry Table
Parents
Component, Include, Registry
Inner Text
None
Children
Choice of elements (min: 0, max: unbounded)
Attributes
Name Type Description Required
Action Enumeration This is the action that will be taken for this registry key. This attribute's value should be one of the following:
append
Appends the specified value(s) to a multiString registry key.
createKey
Creates the key, if absent, when the parent component is installed.
createKeyAndRemoveKeyOnUninstall
Creates the key, if absent, when the parent component is installed then remove the key with all its values and subkeys when the parent component is uninstalled.
prepend
Prepends the specified value(s) to a multiString registry key.
remove
Removes a registry name when the parent component in installed.
removeKeyOnInstall
Removes a key with all its values and subkeys when the parent component is installed.
removeKeyOnUninstall
Removes a key with all its values and subkeys when the parent component is uninstalled.
write
Writes a registry value.
 
Id String Primary key used to identify this particular entry. If this attribute is not specified, an identifier will be generated by hashing the parent Component identifier, Root, Key, and Name.  
Key String The localizable key for the registry value.  
KeyPath YesNoType Set this attribute to 'yes' to make this registry key the KeyPath of the parent component. Only one resource (registry, file, etc) can be the KeyPath of a component.  
Name String The localizable registry value name. If this attribute is not provided the default value for the registry key will be set instead. The Windows Installer allows several special values to be set for this attribute. You should not use them in WiX. Instead use appropriate values in the Action attribute to get the desired behavior.  
Root Enumeration The predefined root key for the registry value. This attribute's value should be one of the following:
HKMU
A per-user installation will make the operation occur under HKEY_CURRENT_USER. A per-machine installation will make the operation occur under HKEY_LOCAL_MACHINE.
HKCR
Operation occurs under HKEY_CLASSES_ROOT. When using Windows 2000 or later, the installer writes or removes the value from the HKCU\Software\Classes hive during per-user installations. When using Windows 2000 or later operating systems, the installer writes or removes the value from the HKLM\Software\Classes hive during per-machine installations.
HKCU
Operation occurs under HKEY_CURRENT_USER. It is recommended to set the KeyPath='yes' attribute when setting this value in order to ensure that the installer writes the necessary registry entries when there are multiple users on the same computer.
HKLM
Operation occurs under HKEY_LOCAL_MACHINE.
HKU
Operation occurs under HKEY_USERS.
 
Type Enumeration Set this attribute to the type of the desired registry key. This attribute must be specified whenever the Value attribute or a child RegistryValue element is specified. This attribute should only be set when the value of the Action attribute does not include the word 'remove'. This attribute's value should be one of the following:
string
The value is interpreted and stored as a string (REG_SZ).
integer
The value is interpreted and stored as an integer (REG_DWORD).
binary
The value is interpreted and stored as a hexadecimal value (REG_BINARY).
expandable
The value is interpreted and stored as an expandable string (REG_EXPAND_SZ).
multiString
The value is interpreted and stored as a multiple strings (REG_MULTI_SZ). Please note that this value will only result in a multi-string value if there is more than one registry value or the Action attribute's value is 'append' or 'prepend'. Otherwise a string value will be created.
 
Value String Set this attribute to the localizable registry value. This value is formatted. The Windows Installer allows several special values to be set for this attribute. You should not use them in WiX. Instead use appropriate values in the Type attribute to get the desired behavior. This attribute cannot be specified if the Action attribute's value contains the word 'remove'.  
See Also
Wix Schema