检测程序集所需的 Silverlight 版本 [英] Detect Silverlight version required by an assembly

查看:47
本文介绍了检测程序集所需的 Silverlight 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何判断 Silverlight 2 是否足以进行程序集或需要 Silverlight 3?
我拥有通过反射获得的所有信息 (Mono.Cecil).

SL 3 与 4 的相同问题.

提前致谢.

解决方案

这可能正是您要找的:

Assembly asm = Assembly.GetExecutingAssembly();string[] 部分 = asm.FullName.Split(',');字符串版本 = 部分 [1];

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

4 向后兼容 3,3 向后兼容 2.

您应该知道应用内置的 Silverlight 版本.

安装和检测:

这个有一个 Javascript 文件,可以检测是否安装了 SL 以及什么版本:http://blog.mdk-photo.com/post/检测-Silverlight-version-installed.aspx

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

使用 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

如果您运行了错误版本的 SL,Thge GAC 还会在编译期间通知您.通常当您安装 Silverlight 工具并尝试编译应用程序时.例如,您的程序集是在第 3 版中创建的,而您使用的控件仅在第 3 版中可用,您必须安装 SL 3 工具,否则构建会出错,让您知道.

有关 Silverlight 程序集的更多信息:

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

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

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).

Same question for SL 3 versus 4.

Thanks in advance.

解决方案

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/

这篇关于检测程序集所需的 Silverlight 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆