Registry Syntax

Now, accessing registry values is almost as easy as getting the value of a property. Getting the value of a registry key uses a similar format to properties. To access a value from the registry the following syntax is used:

$(Registry:<KeyName>[@ValueName])

In this syntax, KeyName is the full name to the registry key and ValueName is an optional parameter specifying which value to extract. If ValueName is not provided then the default value, if it exists, for that key will be returned. To demonstrate this, take a look at the Reg01.proj file, which is shown next. The lines are wrapped here, but the text should be unbroken MSBuild files.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Target ...

Get Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.