引用不同版本的同一总成 [英] Referencing different versions of the same assembly

查看:151
本文介绍了引用不同版本的同一总成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果A引用程序集B 1.1和C和C参考乙1.2,你怎么避免组装的冲突?

If A references assembly B 1.1 and C, and C references B 1.2, how do you avoid assembly conflicts?

我nievely假如使用C的引用将被封装路程,不会引起任何问题,但它似乎所有的被复制到bin,这是在问题出现时的DLL。

I nievely assumed C's references would be encapsulated away and would not cause any problems, but it appears all the dll's are copied to the bin, which is where the problem occurs.

我明白解决这个问题的两种方法都使用海关总署或组装的绑定?海关总署似乎并不喜欢在我身上最好的方法,因为我不喜欢假设的dll会在那里,我喜欢从我的解决方案一个lib目录中引用的DLL。

I understand the two ways around this are to use the GAC or assembly bindings? The GAC doesn't seem like the best approach to me, as I don't like assuming dlls will be there, I prefer to reference dlls from a lib directory in my solution.

作为在哪里组装绑定似乎并不鲁棒我,什么如果组件的一个版本的功能,其他没有,这会不会产生问题?

Where as assembly bindings don't seem robust to me, what if one version of the assembly has functionality that the other doesn't, will this not produce problems?

在我的情况下,它是因为我使用的是第三方的DLL使用的NHibernate一个旧版本的,比我用我自己。

In my case its because I'm using a 3rd party dll uses a older version of nHibernate, than I'm using myself.

推荐答案

我已经取得了过去使用GAC相同的结果,但你应该质疑你的原因有引用多个版本,并尝试尽可能地避免它。如果你必须这样做,一个绑定重定向可能你的情况有所帮助。

I've achieved the same results using the GAC in the past, but you should question your reasons for having to reference more than one version and try to avoid it if possible. If you must do it, a binding redirect may help in your case.

此外,你有没有阅读的吗?

Also, have you read this yet?

这篇关于引用不同版本的同一总成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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