【问题标题】:Nuget: 'Google.Apis' already has a dependency defined for 'Google.Apis.Core'Nuget:“Google.Apis”已经为“Google.Apis.Core”定义了一个依赖项
【发布时间】:2019-01-24 16:42:56
【问题描述】:

我在尝试安装包 Install-Package Google.Apis.Drive.v3 -Version 1.37.0.1470 时在 NuGet 中遇到以下错误。显示以下错误:

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。请帮我解决一下。

【问题讨论】:

    标签: c# visual-studio winforms installation nuget


    【解决方案1】:

    Nuget:“Google.Apis”已经为“Google.Apis.Core”定义了一个依赖项

    由于您的 nuget 版本是 2.8.6031.8.667,因此您可以安装的软件包的最高版本 Google.Apis.Drive.v31.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 (&gt;= 10.0.2)引入了.netstandard依赖:

    这仅受 nuget 2.12 及更高版本支持。那就是您收到该错误信息的原因,请查看类似的线程here

    所以,要解决这个问题,请尝试安装较低版本的软件包版本Google.Apis.Drive.v31.25.0.862。我已经使用 Visual Studio 2012 对其进行了测试,它运行良好。

    此外,如果您想安装该软件包的更高版本,您需要将您的 Visual Studio 更新到 2013

    希望这会有所帮助。

    【讨论】:

    • 感谢您的回复。此版本 1.25.0.862 安装完美。谢谢
    猜你喜欢
    • 1970-01-01
    • 2014-11-01
    • 2017-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多