I am creating an MSBuild task that will read the registry for a specific registry key. If I write the same line of code (see below) in a console application, it returns the expected result, but when it is in the MSBuild task, it does not return anything.
Return Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Setup\", "SQLPath", Nothing)
I would expect the code above to return Nothingif a key / value pair does not exist and return a value if it exists. I get Nothingwhen the MSBuild task is executed. Is there some kind of attribute that I need to apply to the Execute function of the MSBuild task to tell it that it needs to read the registry?
EDIT:
Here's what is done from the MSBuild task:
Return Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Setup\", "SQLPath", Nothing)
I believe this is caused by Registry Redirector on my Vista x64 machine running 32 bit MSBuild. Is there a way to tell the custom MSBuild task (written in VB.Net) to search in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Setup\, then only if nothing exists there, look in HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Setup\?
Thanks,
Scott Blue
source
share