如果有一个作为CustomAction作为MSI安装程序包的一部分调用的类。
它尝试从注册表中读取值(尝试查找本地SQL-Server实例):
RegistryKey sqlServer = Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\Microsoft\Microsoft SQL Server", false );
string[] localInstances = (string[])sqlServer.GetValue( "InstalledInstances" );
作为一个独立的应用程序,这可以正常工作,但是如果从安装程序调用它(以同一个用户身份运行)则不起作用。在安装程序GetValue
中返回null
。
有什么想法吗?
编辑: 我在与同一用户相同的机器上运行安装程序和exe。 FrameWork是Windows 7 64位计算机上的.Net 4
提前致谢
马里奥