WPF .NET: OpenSubkey() don't find value in registry
I've created some values in Windows Registry and try to access them from .NET but there is an error.
Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("ZvezdnyShop") is null, however there is an such key in Registry
REGEDIT http://astzvezdny.newsujet.com/REGEDIT.jpg ERROR IN VS http://astzvezdny.newsujet.com/VS.jpg
What's the matter?
ANSWER
My Application was 32bit, so I need place ZvezdnyShop at HKLM/Software/Wow6432Node Thanks to Frédéric Hamidi
The ZvezdnyShop
key in your screenshot resides in the 64-bit portion of the registry, so it will only be visible to 64-bit applications.
Therefore, if your project targets the x86
platform, the 32-bit application it produces won't see that key.
To fix that problem, you can create the key in the 32-bit portion of the registry, i.e. HKLM\SOFTWARE\Wow6432Node\ZvezdnyShop
, or have your project target the x64
platform.
精彩评论