Silverlight中的Assembly.Load()只适用于全/强名称 [英] Silverlight Assembly.Load() only works with the full/strong name

查看:101
本文介绍了Silverlight中的Assembly.Load()只适用于全/强名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的Assembly.Load()在Silverlight需要一个完整的/强有力的名。显然实施

Apparently the implementation of Assembly.Load() in Silverlight needs a full/strong name.

例如。这个作品:

Assembly.Load("MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...");

而如果已经加载MyAssembly程序,这将失败,即使是:

while this will fail even if MyAssembly is already loaded:

Assembly.Load("MyAssembly");

有一种解决方法,以便它可以使用简单的名称?

Is there a workaround so that it's possible to use the simple name?

推荐答案

据我所知,目前还没有一种方法来解决这个Silverlight中不使用全名。但是,您可能能够完成你的最终目标(这取决于你想要做什么)的另一种方式。例如,XAML分析器是多一点宽容有关程序集的名字,所以,如果你只是想给装配中创建一个类的实例(使用默认构造函数),然后像

As far as I know, there isn't a way to work around this in Silverlight without using the full name. However, you may be able to accomplish your ultimate goal (depending on what you're trying to do) in another way. For example, the XAML parser is a little more forgiving about assembly names, so if you're just trying to create an instance of a class within that assembly (using the default constructor), then something like

XamlReader.Load(<我:类名的xmlns:我='CLR命名空间:myNameSpace对象;装配= MyAssemblyShortName'/>中)

应该做的伎俩。

这篇关于Silverlight中的Assembly.Load()只适用于全/强名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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