.Net 程序集的重命名 [英] Renaming of .Net assemblies

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

问题描述

我们从第三方获得程序集,例如Example.dll.最近供应商引入了一些重大更改,但没有更改组件的名称.我可以将新程序集重命名为例如Example2.dll 并使用反射动态加载它?它没有强命名.

We get an assembly from a third party, e.g. Example.dll. Recently the supplier introduced some breaking changes, but didn't change the name of the assembly. Can I rename the new assembly to e.g. Example2.dll and load it dynamically using reflection? It is not strongly named.

推荐答案

是的,您可以重命名它,因为它不是强命名的,但是,这不会改变程序集使用的命名空间,并且会与其他命名空间发生冲突程序集,如果它们加载在同一个 AppDomain 中.

Yes, you can rename it, since it's not strongly named, However, that won't change the namespaces the assembly uses, and it will conflict with the other assembly if they are loaded in the same AppDomain.

假设您想同时使用两个版本,我能想到的唯一解决方案是将其加载到单独的 AppDomain 中并使用代理进行调用.不过,我不打算详细说明如何做到这一点,因为它可能会变得非常复杂.我的建议是,推回供应商纠正破坏代码,或者给你一个重命名的程序集.

The only solution I can think of, assuming you want to use both versions at the same time, is to load it in a separate AppDomain and use proxies to make the calls. I'm not going to go into detail on how to do that though, as it can get very complex. My advise, push back to the vendor to get the breaking code corrected, or to give you a renamed assembly.

以下是帮助您入门的参考:http://msdn.microsoft.com/en-us/library/yk22e11a(v=vs.110).aspx

Here's a reference to get you started: http://msdn.microsoft.com/en-us/library/yk22e11a(v=vs.110).aspx

这篇关于.Net 程序集的重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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