Silverlight中的Assembly.Load()只适用于全/强名称适用于、名称、Silverlight、Assembly

由网友(缺失的安全感)分享简介:的Assembly.Load()在Silverlight需要一个完整的/强有力的名。显然实施Apparently the implementation of Assembly.Load() in Silverlight needs a full/strong name.例如。这个作品: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'/>中)

应该做的伎俩。

阅读全文

相关推荐

最新文章