c# - Nuget:“Google.Apis”已经为“Google.Apis.Core”定义了一个依赖项
问题描述
尝试安装 package 时,我在 NuGet 中遇到以下错误Install-Package Google.Apis.Drive.v3 -Version 1.37.0.1470
。显示以下错误:
Install-Package : 'Google.Apis' already has a dependency defined for 'Google.Apis.Core'.
At line:1 char:17
+ Install-Package <<<< Google.Apis.Drive.v3 -Version 1.37.0.1470
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
如果我安装以前的版本Install-Package Google.Apis.Drive.v2
。也显示相同的错误:
Install-Package : 'Google.Apis' already has a dependency defined for 'Google.Apis.Core'.
At line:1 char:17
+ Install-Package <<<< Google.Apis.Drive.v2
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
我正在使用 Visual Studio 2012、.net 框架 4.5 和 NuGet 包管理器 2.8.6031.8.667。请帮助我如何解决它。
解决方案
Nuget:“Google.Apis”已经为“Google.Apis.Core”定义了一个依赖项
由于您的 nuget 版本是2.8.6031.8.667
,因此您可以安装的软件包的最高版本Google.Apis.Drive.v3
是1.25.0.862。
详细原因:
该软件包Google.Apis.Drive.v3
具有以下依赖项列表:
Google.Apis.Drive.v3 (>= 1.37.0.1470)
----Google.Apis (>= 1.37.0)
----Google.Apis.Core (>= 1.37.0)
----Newtonsoft.Json (>= 10.0.2)
由于依赖包Newtonsoft.Json (>= 10.0.2)
引入了 .netstandard 依赖:
这仅受 nuget 2.12及更高版本支持。那就是您收到该错误信息的原因,请在此处查看类似的线程。
因此,要解决此问题,请尝试安装较低版本的软件包版本Google.Apis.Drive.v3
1.25.0.862。我已经用我身边的 Visual Studio 2012 对其进行了测试,它工作正常。
此外,如果要安装该软件包的更高版本,则需要将 Visual Studio 更新到2013。
希望这可以帮助。
推荐阅读
- c++ - 当文本框包含浮点值时如何在MFC中获取文本框的值
- python - 输出层有四个节点,但我想使用其中一个节点的输出,我该如何解决?
- c# - 子类和抽象类上的等于运算符
- wordpress - WordPress 中自定义分类法之间的关系
- node.js - 节点邮件模块的 html 支持
- google-bigquery - 谷歌云存储加入多个 csv 文件
- node.js - 使用 pracrand 测试 RNG 的 nodejs JavaScript 堆内存不足
- python-3.x - 如何从python 3中的字符串数据框中找到出现次数最多的句子
- javascript - Google Drive API 压缩文件损坏
- offline - 离线使用 Cartopy 地图