RegistryRead Class

MSBuild

Reads a value from the Registry


Namespace: MSBuild.Community.Tasks
Assembly: MSBuild.Community.Tasks (in MSBuild.Community.Tasks.dll)

Syntax

Visual Basic (Declaration)
Public Class RegistryRead
    Inherits Task
C#
public class RegistryRead : Task
C++
ref class RegistryRead : Task
J#
public class RegistryRead extends Task
JScript
public class RegistryRead extends Task

Example

Read .NET Framework install root from Registry.

 Copy Code
            <RegistryRead 
                KeyName="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" 
                ValueName="InstallRoot">
                <Output TaskParameter="Value" PropertyName="InstallRoot" />
            </RegistryRead>
            <Message Text="InstallRoot: $(InstallRoot)"/>
            

Remarks

The Value parameter is set according to the following rules:

If a DefaultValue is provided, it will be used if the KeyName or ValueName does not exist.
If a DefaultValue is not provided, the KeyName exists, but the ValueName does not exist, Value will be set to an empty string.
If a DefaultValue is not provided, and the KeyName does not exist, the task will fail.

Inheritance Hierarchy

System.Object
   Microsoft.Build.Utilities.Task
      MSBuild.Community.Tasks.RegistryRead

Thread Safety

Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

See Also

Syntax based on .NET Framework version 2.0.
Documentation version 1.0.0.0.