我有一个Visual Studio安装程序项目,该项目会生成MSI,并在安装时创建注册表项/值,但是我无法在regedit之外读取它。
我尝试使用的代码:
RegistryKey test = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Leda\Osm", false);
Key = (string) test.GetValue("API", "");
Console.WriteLine(Key);
我所做的任何尝试都会给出null引用异常。
(要获取我正在调用的cmd框中的密钥(HKLM \ Software上的GetSubKeyNames())