本文介绍了无法从我的Silverlight应用程序调用Assembly.GetName()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的应用程序中显示我的应用程序版本号,而要做到这一点最简单的方法就是使用的版本号集。

  VAR总成= System.Reflection.Assembly.GetExecutingAssembly(); 
变种名称= assembly.GetName();
返回的String.Format(版本{0} {1},name.Version.Major,name.Version.Minor);



我能得到执行组装没有问题,但在调用的GetName( )返回 MethodAccessException 此消息



Why is this happening, is there anything I can do about it, and if not is there another means of retrieving the assembly version?

解决方案

The Assembly.GetName is marked with SecurityCriticalAttribute attribute try using GetCallingAssembly().FullName and scrape the version info out of it.

from: http://msdn.microsoft.com/en-us/library/9w2wdeze(VS.95).aspx

这篇关于无法从我的Silverlight应用程序调用Assembly.GetName()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 09:25