Registry.LocalMachine.OpenSubKey() returns null
To verify excel installed on my local system; initially I tried using OpenSubKey() method. But it was always returning null, even though I can see the registry key using regedit.exe. I was using a Windows 8, x64 bit OS and the application was developed in VS 2008, Winforms, x86 platform. Later I found the reason - A 32-bit application on a 64-bit OS will be looking at the HKLM\Software\Wow6432Node node by default. To read the 64-bit version of the key, you’ll need to specify the RegistryView enumeration using OpenBaseKey() method.(This API is added in .Net 4.0.) And if you are using .Net 3.5 or below, either you need to build the application using Any CPU or x64 platform target.
You can find more details about RegistryKey.OpenBaseKey() method and RegistryView Enumeration in MSDN.