mardi 4 août 2015

MSI is not able to access registry when I update OS

I have created a MSI project. My purpose is to create registries and assigned some values to them while installing. I am creating registry under HKEY_CURRENT_USER\Software. I have some default set of registries that I have created using Registry Editor from solution explorer. Also I have an installer class using which I have created some more registries based on some conditions. Here is my code snipet for the same:

If Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\ABCD\DB").GetValue(RegName) Is Nothing Then
                Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\ABCD\DB", True).SetValue(RegName, RegVal)
End If

Here RegName is the Registry name to be created and RegVal is the value to be set for RegName Registry.

When I am installing this MSI, Registries, which I have created at the design time by using Registry Editor using Solution Explorer, create and assign values to them successfully. But the issue is registries those are created by installer class, is not creating. It throws an exception when I tried to check weather RegName is nothing or not. Thrown exception is : "Object is not set to instance of an object". Actually it works fine for all the machine which are not having Windows update. This behaviour occurs when machine OS is updated. I dont know what is an exact issue. Why does it fail for updated machine? I have tried a lot but cant get any proper solution. Also one thing, the issue is occurs on Windows 10. When I set MSI to run for the "All user" it will give this exception. MSI will work fine if I select run MSI for "Just me" option. Waiting for appropriate suggestions. Quick response are highly appriciable.

Thanks, Ankit

Aucun commentaire:

Enregistrer un commentaire