Valid TaskActions are:

CheckEmpty (Required: RegistryHive, Key Output: Empty)

CheckValueExists (Required: RegistryHive, Key, Value Output: Exists

CreateKey (Required: RegistryHive, Key)

DeleteKey (Required: RegistryHive, Key)

DeleteKeyTree (Required: RegistryHive, Key)

DeleteValue (Required: RegistryHive, Key, Value)

Get (Required: RegistryHive, Key, Value Output: Data)

Set (Required: RegistryHive, Key, Value Optional: DataType)

Remote Execution Support: Yes

Namespace: MSBuild.ExtensionPack.Computer
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 3.5.0.0

Examples

Xml Copy imageCopy
<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <!-- Create a key -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="CreateKey" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp"/>
        <!-- Check if a key is empty -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="CheckEmpty" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp">
            <Output PropertyName="REmpty" TaskParameter="Empty"/>
        </MSBuild.ExtensionPack.Computer.Registry>
        <Message Text="SOFTWARE\ANewTemp is empty: $(REmpty)"/>
        <!-- Set a value -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="Set" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp" Value="MySetting" Data="21"/>
        <!-- Check if the value exists -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="CheckValueExists" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp" Value="MySetting">
            <Output PropertyName="RExists" TaskParameter="Exists"/>
        </MSBuild.ExtensionPack.Computer.Registry>
        <Message Text="SOFTWARE\ANewTemp\@MySetting exists: $(RExists)"/>
        <!-- Get the value out -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="Get" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp" Value="MySetting">
            <Output PropertyName="RData" TaskParameter="Data"/>
        </MSBuild.ExtensionPack.Computer.Registry>
        <Message Text="Registry Value: $(RData)"/>
        <!-- Check if a key is empty again -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="CheckEmpty" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp">
            <Output PropertyName="REmpty" TaskParameter="Empty"/>
        </MSBuild.ExtensionPack.Computer.Registry>
        <Message Text="SOFTWARE\ANewTemp is empty: $(REmpty)"/>
        <!-- Set some Binary Data -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="Set" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp" DataType="Binary" Value="binval" Data="10, 43, 44, 45, 14, 255" />
        <!--Get some Binary Data--> 
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="Get" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp" Value="binval">
            <Output PropertyName="RData" TaskParameter="Data"/>
        </MSBuild.ExtensionPack.Computer.Registry>
        <Message Text="Registry Value: $(RData)"/>
        <!-- Delete a value -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="DeleteValue" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp" Value="MySetting" />
        <!-- Delete a key -->
        <MSBuild.ExtensionPack.Computer.Registry TaskAction="DeleteKey" RegistryHive="LocalMachine" Key="SOFTWARE\ANewTemp"/>
    </Target>
</Project>

Inheritance Hierarchy

System..::..Object
  Microsoft.Build.Utilities..::..Task
    MSBuild.ExtensionPack..::..BaseTask
      MSBuild.ExtensionPack.Computer..::..Registry

See Also