InstallerTaskBase.

InstallerRegistryElement Property

Summary

Makes modifications to the Windows Registry of the target computer at runtime.

Parameters

Attribute Type Description Required
component string Refrence to a component. The component that controls the installation of the registry value. True
root msi:MSIRegistryKeyRoot Valid input:
  • dependent - If this is a per-user installation, the registry value is written under HKEY_CURRENT_USER. If this is a per-machine installation, the registry value is written under HKEY_LOCAL_MACHINE. Note that a per-machine installation is specified by setting the ALLUSERS property to 1.
  • machine represents HKEY_LOCAL_MACHINE
  • classes represents HKEY_CLASSES_ROOT
  • user represents HKEY_CURRENT_USER
  • users represents HKEY_USERS
True
path string Registry key. True

Nested Elements:

<value>

    Specifies the registry value to add to the target machine. Attribute Type Description Required name string The registry value name (localizable). If this is Null, then the data entered into the Value column are written to the default registry key.
    If the Value column is Null, then the strings shown in the following table in the Name column have special significance. String Description + The key is to be created, if absent, when the component is installed. - The key is to be deleted, if present, with all of its values and subkeys, when the component is uninstalled. * The key is to be created, if absent, when the component is installed. Additionally, the key is to be deleted, if present, with all of its values and subkeys, when the component is uninstalled.
    False
    value string The localizable registry value. The field is Formatted. If the value is attached to one of the following prefixes (i.e. #%value) then the value is interpreted as described in the table. Note that each prefix begins with a number sign (#). If the value begins with two or more consecutive number signs (#), the first # is ignored and value is interpreted and stored as a string. Prefix Description #x The value is interpreted and stored as a hexadecimal value (REG_BINARY). #% The value is interpreted and stored as an expandable string (REG_EXPAND_SZ). # The value is interpreted and stored as an integer (REG_DWORD). If the value contains the sequence tilde [~], then the value is interpreted as a Null-delimited list of strings (REG_MULTI_SZ). For example, to specify a list containing the three strings a, b and c, use "a[~]b[~]c." The sequence [~] within the value separates the individual strings and is interpreted and stored as a Null character. If a [~] precedes the string list, the strings are to be appended to any existing registry value strings. If an appending string already occurs in the registry value, the original occurrence of the string is removed. If a [~] follows the end of the string list, the strings are to be prepended to any existing registry value strings. If a prepending string already occurs in the registry value, the original occurrence of the string is removed. If a [~] is at both the beginning and the end or at neither the beginning nor the end of the string list, the strings are to replace any existing registry value strings. Otherwise, the value is interpreted and stored as a string (REG_SZ). False dword string A dword value to input, if the value attribute is null. This removes the requirement of adding "#" before the value. False id string Primary key used to identify a registry record. False

</value>

Examples

Add the a couple registry entries on the target machine. <registry> <key component="C__MainFiles" root="machine" path="SOFTWARE\ACME\My Product\" > <value name="ProductVersion" value="1.0.0" /> <value name="ProductDir" value="[TARGETDIR]" /> <value name="VirtualDir" value="[TARGETVDIR]" /> </key> </registry> Add a default key value to the specified registry key path <registry> <key component="C__MainFiles" root="machine" path="SOFTWARE\ACME\My Product\" > <value value="1.0.0" /> </key> </registry> Another way to add a default key value to the specified registry key path <registry> <key component="C__MainFiles" root="machine" path="SOFTWARE\ACME\My Product\" > <value name="" value="1.0.0" /> </key> </registry> Specify hexadecimal value (REG_BINARY) for the default key <registry> <key component="C__MainFiles" root="machine" path="SOFTWARE\ACME\My Product\" > <value> 1a,81,0a,03,01,00,06,00,00,00,d3,15,fd,00,01,00,00,00,00,00,01, 00,00,00,00,00,00,00,00,00,00,00,b0,90,ce,09,01,00,00,00,00,00,ff,ff,ff,00, 00,00,00,00,00,00,00,00,6d,7a,0a,03,01,00,00,00,00,00,00,00,38,40,00,00,00, 00,00,00,00,00,00,00,00,00,90,01,00,00,00,00,00,01,00,00,00,00,0f,00,00,00, f0,ff,ff,ff,54,69,6d,65,73,20,4e,65,77,20,52,6f,6d,61,6e,f4,6f,d4,08,02,00 </value> </key> </registry>
Assembly
NAnt.Contrib.dll
Namespace
NAnt.Contrib.Tasks.Msi
Containing Type
InstallerTaskBase

Syntax

[BuildElement("registry", ProcessXml = false)]
public SchemaElement[] InstallerRegistryElement { get; set; }

Attributes

Type Description
BuildElement

Value

Type Description
SchemaElement[]