如何注册非强名称组件被装载,好像它是在GAC? [英] How to register a non-strong-name assembly to be loaded as if it were in the GAC?

查看:213
本文介绍了如何注册非强名称组件被装载,好像它是在GAC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的一个合作伙伴为我们提供了我们需要从我们的应用程序访问的程序集。不幸的是,这不是强名称,所以我们不能把它安装到GAC。我们不能将它放在同一个地方作为我们的可执行文件。

One of our partners provided us with an assembly we need to access from our application. Unfortunately, this is not strong-name so we can't install it to the GAC. And we can't place it in the same place as our executable.

是否有解决方案吗?

编辑:这将是只用于测试治标不治本,当他们去RC,我们将有一个强命名程序集

This will be a temporary solution only for testing, when they go RC, we will have a strong-named assembly.

推荐答案

您有几种选择在这一点上。

You have a few options at that point.

第一种方法是将组件在具有的所述名称的目录组件(不包括扩展名),它是应用程序目录的子目录。

The first is to place the assembly in a directory that has the name of the assembly (without the extension) which is a subdirectory of the application directory.

二是指定要在CLR探测使用的探测元素

The second is to specify the sub directory you want the CLR to probe for references in the app.config file using the probing element.

最后,可以动态使用的Assembly类的各种 load方法加载程序集但我要说,这是一个的非常的坏在这种情况下的想法,因为你有装配,你必须要在其使用的具体类型。当你要替换它执行某些抽象的,这似乎并不在这里的情况下这样的时间较晚组件加载通常使用。

Finally, you can load the assembly dynamically using the various Load methods on the Assembly class but I would say that's a very bad idea in this case, given that you have the assembly, and you have concrete types that you want to use in it. Late time assembly loading like this is typically used when you want to subsitute the implementation of certain abstractions, which doesn't seem to be the case here.

这篇关于如何注册非强名称组件被装载,好像它是在GAC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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