$(Registry:FOO) executed with RegistryView.Default which is the 32 bit view from devenv.exe - by Justin Dearing zippy1981

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 774610 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 12/17/2012 8:20:34 PM
Access Restriction Public


In MSBuild 3.5, the $(Registry:FOO) syntax was added to let you reference registry values in an MSBuild file. 

However, devenv.exe has remained a 32 bit executable for numerous reasons (http://blogs.msdn.com/b/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx). As a result If I want to look at $(Registry:HKEY_LOCAL_MACHINE\Software) I actually get $(HKEY_LOCAL_MACHINE\Wow6432Node\Software). I've worked around this issue with the MsBuild Community Extensions, http://msbuildextensionpack.codeplex.com/ but its very arkward.

If I run msbuild from a x64 vcvars32.bat environment, the 64 bit msbuild.exe causes the proper registry key to be read. 
Sign in to post a comment.
Posted by Microsoft on 12/19/2012 at 9:02 AM
As pointed out, the GetRegistryValueFromView property does what you are proposing. Thanks for the feedback.

David Kean
Posted by Justin Dearing zippy1981 on 12/19/2012 at 5:23 AM
David Kean pointed out this is already implemented: https://twitter.com/davkean/status/281243328002015232
See http://msdn.microsoft.com/en-us/library/dd633440.aspx#BKMK_GetRegistryValueFromView

Example syntax:
<MsBuild4NativeProductId>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'ProductId', null, RegistryView.Registry64))</MsBuild4NativeProductId>
     <MsBuild4NativeProductName>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'ProductName', null, RegistryView.Registry64))</MsBuild4NativeProductName>
Posted by Justin Dearing zippy1981 on 12/18/2012 at 6:33 AM
I propose the following solution:

$Registry32: forces RegistryView.Registry32
$Registry64: forces RegistryView.Registry64
$RegistryBuildPlatform: forces RegistryView.Registry32 for x86, RegistryView.Registry64 for x64 and RegistryView.RegistryDefault for AnyCPU,

Posted by Microsoft on 12/18/2012 at 2:08 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 12/17/2012 at 9:52 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)