How to deal with multiple versions of dependencies

2020-02-13 05:46发布

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.

1条回答
老娘就宠你
2楼-- · 2020-02-13 06:21

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.

查看更多
登录 后发表回答