Registry Class | MSBuild Extension Pack Help 4.0.12.0 |
CheckEmpty (Required: RegistryHive, Key Optional: RegistryView Output: Empty)
CheckValueExists (Required: RegistryHive, Key, Value Optional: RegistryView Output: Empty (true iff the value does not exist))
CreateKey (Required: RegistryHive, Key Optional: RegistryView)
DeleteKey (Required: RegistryHive, Key Optional: RegistryView)
DeleteKeyTree (Required: RegistryHive, Key Optional: RegistryView )
DeleteValue (Required: RegistryHive, Key, Value Optional: RegistryViewOutput: Empty (true iff the Delete was redundant))
Get (Required: RegistryHive, Key, Value Optional: RegistryView Output: Data)
Set (Required: RegistryHive, Key, Value Optional: DataType, RegistryView)
Remote Execution Support: Yes
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.ComputerRegistry
Namespace: MSBuild.ExtensionPack.Computer
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The Registry type exposes the following members.
Name | Description | |
---|---|---|
Registry |
Name | Description | |
---|---|---|
Data |
Gets the data.
| |
DataType |
Sets the type of the data. RegistryValueKind Enumeration. Support for Binary, DWord, MultiString, QWord, ExpandString
| |
Empty |
Indicates whether the Registry Key is empty or not
| |
Exists |
Indicates whether the Registry value exists
| |
Key |
Sets the key.
| |
RegistryHive |
Sets the Registry Hive. Supports ClassesRoot, CurrentUser, LocalMachine, Users, PerformanceData, CurrentConfig, DynData
| |
RegistryView |
Sets the Registry View. Supports Registry32, Registry64 and Default. Defaults to Default
| |
Value |
Sets the value. If Value is not provided, an attempt will be made to read the Default Value.
|
<Project ToolsVersion="4.0" 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>