Nuget软件包依赖关系.它按应有的方式工作吗? [英] Nuget package dependencies. Does it work the way it should?

查看:160
本文介绍了Nuget软件包依赖关系.它按应有的方式工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RavenDb最新版本作为nuget软件包安装.它引用了Newtonsoft.Json 4.0.2. 我正在尝试安装TweetSharp.我收到此日志:

RavenDb latest version is installed as a nuget package. It references Newtonsoft.Json 4.0.2. I'm trying to install TweetSharp. I get this log:

M> Install-Package TweetSharp
Attempting to resolve dependency 'Hammock (≥ 1.2.3)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 4.0.1)'.
Successfully installed 'Hammock 1.2.6'.
Successfully installed 'Newtonsoft.Json 4.0.3'.
Successfully installed 'TweetSharp 2.0.8'.
Install failed. Rolling back...
Install-Package : Updating 'Newtonsoft.Json 4.0.2' to 'Newtonsoft.Json 4.0.3'
   failed. Unable to find a version of 'RavenDB-Embedded' that is compatible with
   'Newtonsoft.Json 4.0.3'.

如您所见,即使TweetSharp仅需要"Newtonsoft.Json(≥4.0.1)",nuget仍要安装无法与RavenDb一起使用的4.0.3版本.

As you can see, even if TweetSharp just needs 'Newtonsoft.Json (≥ 4.0.1)', nuget wants to install version 4.0.3 which can not work with RavenDb.

我尝试安装TweetSharp的早期版本,但它没有任何改变.

I tried to install previous versions of TweetSharp but it does not change anything.

有什么办法可以避免这种情况?

Any way to circumvent this?

推荐答案

这归因于NuGet自1.6版以来的语义版本控制. 此处对此进行了详细说明基本思想是,如果您的依存关系没有更新主版本号或次要修订号,则他们会认为这是一个错误修正,而不是重大更改.

This is down to the semantic versioning that NuGet has had since (I think) 1.6. It's explained in more detail here but the basic idea is that if your dependency hasn't updated either the major or the minor revision number then they'll assume that it's a bugfix and not a breaking change.

因此,在这种情况下,决定安装4.0.3而不是4.0.1.

So in this case the decision to install 4.0.3 instead of 4.0.1 was made.

您可以使用-ignoredependencies运行install-package我以为如果您安装了4.0.2,它就不会尝试更新您的内容(因为4.0.2满足了该依赖性).

You can run install-package with -ignoredependencies I would have thought that if you'd had 4.0.2 installed it wouldn't try to update you (because 4.0.2 satisfies the dependency).

这篇关于Nuget软件包依赖关系.它按应有的方式工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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