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

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

问题描述

您好我有一个依赖层次,我不能确定如何解决一个问题:

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

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

问题是我应该如何参考这些依赖关系MyProject的项目。我已经建立BaseProject和CommonUtil(1.0版),它建有成组件。现在,在MyProject的,我使用的类CommonUtil,我不确定我是否应该引用CommonUtil.v.1.0或者如果我可以/应该参考CommonUtil的当前版本(2.0版)。

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).

这CommonUtils装配应我从MyProject的参考? 我不能引用这两个组件作为VS告诉我它无法确定使用哪个程序集,因为它们都包含一些相同的方法。如果我只引用V.1.0我也许不会有我需要的一切,从2.0版,如果我只引用2.0版我也许不会有V.1.0所有功能(这BaseProject)的需求。

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.

推荐答案

如果您使用的是BaseProject直接返回在MyProject的类,你需要坚持使用同一版本(1.0)。但是,如果BaseProject只在内部使用这些类,不与MyProject的分享,你可以放心地使用新版本(2.0)。

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