为什么C#看不到现有的注册表项?

时间:2019-03-26 15:47:42

标签: c# windows registry

我有一个Visual Studio安装程序项目,该项目会生成MSI,并在安装时创建注册表项/值,但是我无法在regedit之外读取它。

Registry

我尝试使用的代码:


RegistryKey test = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Leda\Osm", false);
Key = (string) test.GetValue("API", "");
Console.WriteLine(Key);

我所做的任何尝试都会给出null引用异常。

(要获取我正在调用的cmd框中的密钥(HKLM \ Software上的GetSubKeyNames())

0 个答案:

没有答案