<readregistry>

Reads a value or set of values from the Windows Registry into one or more NAnt properties.

Parameters

Attribute Type Description Required
key string
The registry key to read, including the path.
True
property string

The property to set to the specified registry key value.

If this attribute is used then a single value will be read.

False
prefix string

The prefix to use for the specified registry key values.

If this attribute is used then all registry values will be read and stored as properties with this prefix.

False
hive string
Space separated list of registry hives to search for NAnt.Win32.Tasks.ReadRegistryTask.RegistryKey. For a list of possible values, see Microsoft.Win32.RegistryHive. The default is Microsoft.Win32.RegistryHive.LocalMachine.
False
failonerror bool
Determines if task failure stops the build, or is just reported. The default is true.
False
if bool
If true then the task will be executed; otherwise, skipped. The default is true.
False
unless bool
Opposite of NAnt.Core.Task.IfDefined. If false then the task will be executed; otherwise, skipped. The default is false.
False
verbose bool
Determines whether the task should report detailed build log messages. The default is false.
False

Examples

Read a single value from the registry.

<readregistry property="sdkRoot" key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRoot" hive="LocalMachine" />

Read all the registry values in a key.

<readregistry prefix="dotNetFX" key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRoot" hive="LocalMachine" />

Requirements

Assembly
NAnt.Win32.dll
Namespace
NAnt.Win32.Tasks