开发者

Finding Silverlight version & Installation Folder programmatically

Is it possible to find the version of the installed Silverlight (e.x. 4.0.51204.0) and its installation folder (e.x. C:\Program Files (x86)\Microsoft Silverlight\4开发者_Go百科.0.51204.0) in a C# program?

Some notes:

  1. Not within a Silverlight application, but from somewhere else (for example in a console application)
  2. This is NOT such a thing as HKEY_LOCAL_MACHINE\Software\Microsoft\Silverlight in my machine.


There should be a key in the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Silverlight\Version

The installation folder should always be:

%ProgramFiles%\Microsoft Silverlight

You could also read the version number from the files in this directory (sllauncher.exe for example).


Silverlight runtime is a CLR, as such any .NET code running within it can use any standard method available to it. In this case, System.Environment.Version is used to get the version of the CLR that the executing code is presently running within, if you use this from within a silverlight application you will get the silverlight version running on that sys


On a 64-bit computer the registry key might be found here: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Silverlight\Version


You can visit the official page of Silverlight to check the version.

EDIT: You can do it from a console application. Just fetch the web page in a buffer and find the version number using regular expressions or simple string processing. See here for an example of how to fetch a web page in a buffer.

EDIT: See this question. This might work for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜