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

查看:140
本文介绍了重命名.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.

推荐答案

是的,你可以重命名它,因为它不是强命名,不过,这不会改变组件使用的命名空间,它会与其它冲突装配如果它们被加载在相同的应用程序域

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,并使用代理打的电话。我不打算进入细节如何做到这一点,虽然,因为它可以变得非常复杂。我的建议,推回给供应商,以获得破code纠正,或者给你一个重命名组件。

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天全站免登陆