MSBuild.ExtensionPack.Computer.Registry CreateKey not working

Apr 18, 2012 at 1:56 PM

Hello,

I am trying to set some basic settings in the registry during Debug build process.  Nothing too out of the ordinary:

<MSBuild.ExtensionPack.Computer.Registry TaskAction="CreateKey" RegistryHive="LocalMachine" Key="SOFTWARE\Company" />
<MSBuild.ExtensionPack.Computer.Registry TaskAction="CreateKey" RegistryHive="LocalMachine" Key="SOFTWARE\Company\ProductOrFeature" />

That's it. I've got this organized in an MSBuild Project Target and I know the Target is being processed. Only the expected keys don't appear in the registry afterwards.

So... How do we get this to work during the build process? Is it a permissions issue or something?

We're running VS2010 in a Windows 7 Professional environment.

It's either that or (plausibly) "Exec" a REG file, which is a distinct possibility.

Best regards,

Michael

Apr 18, 2012 at 1:58 PM

One thought: it may be a Target Framework issue also... We're targeting v3.5 framework and running against MSBuildExtensionPack for 4.0 in the import. Don't know there are hooks to detect this and avert that situation?

Apr 18, 2012 at 2:20 PM
mwpowellhtx wrote:

One thought: it may be a Target Framework issue also... We're targeting v3.5 framework and running against MSBuildExtensionPack for 4.0 in the import. Don't know there are hooks to detect this and avert that situation?

This doesn't seem to be the issue. Rebuild with the 3.5 targeted MSBEP and still doesn't work.

Is there a log? Or policy perhaps that is blocking this?

Apr 18, 2012 at 3:17 PM

I think I found the answer. We're working on a 64-bit machine, so these things actually land in a slightly different Registry area for a 32-bit application: that's in the HKLM\SOFTWARE\Wow6432Node key... and so on and so on.

Coordinator
Apr 18, 2012 at 6:42 PM

Yip, sounds right, your're experiencing Registry Redirection http://msdn.microsoft.com/en-us/library/aa384232(v=vs.85).aspx

If you move to the 4.0 library you can make use of the RegistryView property if necessary. If you want to create a key in the 64bit view, you can exec out to msbuild 64 and call back into your project.

Mike