[英]Prevent Nuget from downloading the most updated version of a dependency
I used Nuget for downloading a specific version of CouchbaseClient which is a .Net client for a NoSql product. 我使用Nuget下载特定版本的CouchbaseClient ,这是NoSql产品的.Net客户端。
This dll has a dependency in Newton.Json , so this is what happened when using Nuget: 该dll在Newton.Json中具有依赖项,因此使用Nuget时会发生以下情况:
Install-Package CouchbaseNetClient -Version 1.3.6
Attempting to resolve dependency 'Newtonsoft.Json'.
Installing 'Newtonsoft.Json 6.0.5'.
Successfully installed 'Newtonsoft.Json 6.0.5'.
Installing 'CouchbaseNetClient 1.3.6'.
Successfully installed 'CouchbaseNetClient 1.3.6'.
Adding 'Newtonsoft.Json 6.0.5' to DataAccess.
Successfully added 'Newtonsoft.Json 6.0.5' to DataAccess.
Adding 'CouchbaseNetClient 1.3.6' to DataAccess.
Successfully added 'CouchbaseNetClient 1.3.6' to DataAccess.
The problem is, that when i ran the unit tests an exception was thrown that it is looking for Newton.Json version 4.5.0. 问题是,当我运行单元测试时,抛出了一个异常,它正在寻找Newton.Json版本4.5.0。
So , i needed to remove manually the Newton.Json 6.0.5 that Nuget downloaded for me and added with Nuget Newton.Json 4.5.0. 因此,我需要手动删除Nuget为我下载并添加了Nuget Newton.Json 4.5.0的Newton.Json 6.0.5。
Is there a simpler way to do it? 有更简单的方法吗? I do not want to do this manual process each time i will download a package with dependencies which are not the most updated version.
我不想每次我下载具有非最新版本依赖关系的软件包时都执行此手动过程。
Your options are: 您的选择是:
If Newtonsoft.Json 4.5.11 was already installed then CouchbaseNetClient would not install a later version unless you do not have Newtonsoft.Json installed already or you are using an old version of NuGet (older than NuGet 2.5). 如果已经安装了Newtonsoft.Json 4.5.11,则除非尚未安装Newtonsoft.Json或使用的是NuGet的旧版本(比NuGet 2.5的旧版本)大,否则CouchbaseNetClient不会安装更高的版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.