开发者

Detect Silverlight version required by an assembly

开发者 https://www.devze.com 2022-12-13 06:46 出处:网络
How can I tell whether Silverlight 2 is sufficient for an assembly or Silverlight 3 is required? I have all information that is available through reflection (Mono.Cecil).

How can I tell whether Silverlight 2 is sufficient for an assembly or Silverlight 3 is required?

I have all information that is available through reflection (Mono.Cecil).

Sam开发者_如何学Pythone question for SL 3 versus 4.

Thanks in advance.


You cannot tell from just the class library and its metadata - this can only be reliably determined from a Silverlight application's embedded manifest file in the .Xap.


This might be exactly what you are looking for:

Assembly asm = Assembly.GetExecutingAssembly(); 
string[] parts = asm.FullName.Split(',');
string version = parts[1];

http://forums.silverlight.net/forums/p/23321/82774.aspx#82774

4 is backward compatible with 3, 3 is backward compatiable with 2.

You should know which version of silverlight the app is built in.

Installation and detection:

This one has a Javascript file that will detect if SL is installed and What version: http://blog.mdk-photo.com/post/Detecting-Silverlight-version-installed.aspx

http://www.apijunkie.com/APIJunkie/blog/post/2009/04/How-to-programmatically-detect-Silverlight-version.aspx

Version detection with Silverlight

http://www.scribd.com/doc/14938624/Creating-a-Custom-Silverlight-Installation-Experience

http://blogs.msdn.com/tims/archive/2007/10/29/optimizing-the-silverlight-install-experience.aspx

Thge GAC will also notify you durring compile if you are running the wrong version of SL. Typically when you have Silverlight tools installed and try to compile an app. For instance your assembly is created in version 3 and you use a control that is only available in 3, you will have to have SL 3 tools installed or the build will error letting you know.

More on the Silverlight assemblies:

http://www.netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight

http://nerddawg.members.winisp.net/AssemblySniffer/

0

精彩评论

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