如何处理多个版本的依赖关系? [英] How to deal with multiple versions of dependencies?

查看:162
本文介绍了如何处理多个版本的依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个依赖关系层次的问题我不确定如何解决:



alt text http://img525.imageshack.us/my.php?image=56330713it2.jpg
http://img525.imageshack.us/my.php?image=56330713it2.jpg



问题是如何从MyProject项目中引用这些依赖关系。我已经构建了BaseProject和CommonUtil(版本1.0),它被构建到程序集中。现在在MyProject中,我正在使用CommonUtil中的类,我不知道我是否应该引用CommonUtil.v.1.0,或者我可以/应该引用当前版本的CommonUtil(v 2.0)。



我的MyProject应该引用哪个CommonUtils程序集?
我不能引用两个程序集,因为VS告诉我,它不能确定使用哪个程序集,因为它们都包含一些相同的方法。如果我仅仅引用v.1.0,我可能没有从v.2.0需要的一切,如果我仅仅引用v.2.0,我可能没有v.1.0(哪个BaseProject)需要的所有功能。

解决方案

如果您正在使用BaseProject直接在MyProject中返回的类,则需要使用相同的版本(1.0)。但是,如果BaseProject仅在内部使用这些类,并且不与MyProject共享,则可以安全地使用新版本(2.0)。



最佳实践:强制命名您的程序集,以便编译器可以帮助您。


Hi I have a problem with a dependency hierarchy I am unsure how to solve:

alt text http://img525.imageshack.us/my.php?image=56330713it2.jpg http://img525.imageshack.us/my.php?image=56330713it2.jpg

The problem is with how I should reference these dependencies from MyProject project. I have built BaseProject and the CommonUtil(version 1.0) it was built with into assemblies. Now in MyProject I am using classes from CommonUtil and I am unsure if I should reference the CommonUtil.v.1.0 or if I could/should reference the current version of CommonUtil (v 2.0).

Which CommonUtils assembly should I reference from my MyProject? I cannot reference both assemblies as VS tells me it cannot determine which assembly to use as they both contain some of the same methods. If I only reference v.1.0 I would perhaps not have everything I need from v.2.0 and If I only reference v.2.0 I would perhaps not have all capabilities in v.1.0 (which BaseProject) needs.

解决方案

If you are using the classes that BaseProject returns directly within MyProject, you need to stick with the same version (1.0). But if BaseProject only uses those classes internally and does not share with MyProject, you can safely use the new version (2.0).

Best practice: strongly name your assemblies so that the compiler can help you out.

这篇关于如何处理多个版本的依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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