当多次获得相同的依赖项时,nuget不检查版本

时间:2011-07-19 14:11:23

标签: nuget nuget-package

我公司现在正在使用nuget来打包所有共享程序集。我们还开始使用标签基于semver对它们进行版本控制。

我的情况是nuget没有像我期望的那样工作。

我有3个共享程序集....

  • 枚举
  • 通用
  • BusinessLogic

就包裹参考而言......

  • Common =>枚举
  • BusinessLogic => Common,Enum

BusinessLogic依赖于Common和Enum的原因是我不想在不需要使用刚刚添加的新枚举时更新Common的依赖(以及重建,打包,发布)用于BusinessLogic

因此,我添加了一个枚举,并希望在BusinessLogic中使用它。

在我这样做之前,这些是一切的版本......

  • Enum = 1.4.0
  • Common = 1.2.1
  • BusinessLogic = 2.0.1

我现在将要在BusinessLogic中使用的新枚举值添加到Enum项目并构建,打包,发布......

  • Enum = 1.5.0
  • Common = 1.2.1
  • BusinessLogic = 2.0.1

现在,我对BusinessLogic,提交,推送,打包等进行了更改......

  • Enum = 1.5.0
  • Common = 1.2.1
  • BusinessLogic = 2.1.0

所以,现在依赖性看起来像这样......

  • Common => Enum 1.4.0
  • BusinessLogic => Enum 1.5.0

现在我跑......

nuget pack BusinessLogic.csproj

我期望发生的是nuget将看到Common需要1.4.0的Enum,但BusinessLogic需要1.5.0,因此在Enum >= 1.5.0的包中添加了一个依赖,但是Enum没有依赖性所有,我认为它假设Common会实现它。

这是设计的行为吗?

1 个答案:

答案 0 :(得分:1)

我同意你的看法,目前的行为是不正确的。 nuget尝试优化依赖关系以将它们保持在最小集合,但不考虑版本不同的情况。

请你在http://nuget.codeplex.com/上提交一个错误,以便它显示在雷达上?

作为现在的解决方法,您应该能够在用于构建BusinessLogic包的随附.nuspec文件中显式添加依赖项。