How To Determine Silverlight version on x64 machines?

末鹿安然 提交于 2019-12-12 02:41:42

问题


According to the latest silverlight deployment guide, I can determine what version of silverlight is installed by

-Querying the: “HKLM\Software\Microsoft\Silverlight\Version” registry key

This works great on my 32 bit dev machine. But on a couple of 64 bit machines, HKLM\Software\Microsoft\Silverlight doesn't exist.

Where is it on x64 machines?


回答1:


Look in HKLM\Software\Wow6432Node, the home for registry keys that 32-bit programs can see.




回答2:


Searching through my registry, I found this:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Silverlight

Can anyone confirm that this is a safe place to look?




回答3:


I know this has been answered but you can use 'RegistryKey' with .Net 4. This allow's your 32 bit program to access the 64 bit registry as it would be normally viewed on your 64 bit machine. The code:

using Microsoft.Win32;

RegistryKey registryBase = Registry.LocalMachine; // This would give you the standard Registry if you were using your own machine. Not needed for this example.

registryBase = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); // This will allow your 32 bit program to view the 64 bit registry.

RegistryKey getKey = registryBase.OpenSubKey("HKLM\Software\Microsoft\Silverlight\Version", true); // Set to true or false to allow write permissions.

getKey.SetValue("VersionKey", "0", RegistryValueKind.DWord); //Allow's you to edit the exact key type. Just change DWord etc...

Hope this is useful. I use this as sometimes you cannot view all keys required in 'Wow6432Node'.



来源:https://stackoverflow.com/questions/5317603/how-to-determine-silverlight-version-on-x64-machines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!