简体   繁体   English

nuGet无法在Visual Studio中安装第二个API

[英]nuGet fails to install a second API in Visual Studio

I'm creating a C# program that needs to access both the Google drive and sheets API. 我正在创建一个需要访问Google驱动器和Sheets API的C#程序。 When I install the first API(Drive) with the NuGet Console it successfully installs and it allows me to use it fine. 当我使用NuGet控制台安装第一个API(驱动器)时,它会成功安装,并且可以很好地使用它。 The problem, however, lies with installing the second API. 但是,问题在于安装第二个API。 When I type in the command to install the Sheets API 当我键入命令以安装Sheets API时

Install-Package Google.Apis.Sheets.v4

it returns the following error message: 它返回以下错误消息:

 Attempting to gather dependencies information for package 
 'Google.Apis.Sheets.v4.1.29.2.1002' with respect to project    
 'CSIBriarcliffAppUpdater', targeting '.NETFramework,Version=v4.5.2'
  install-package : An error occurred while retrieving package metadata 
  for 'Google.Apis.Drive.v3.1.29.2.995' from source 'C:\Users\Lior Ben-
  David\documents\visual 
  studio 2015\Projects\CSIBriarcliffAppUpdater\packages'.
  At line:1 char:1
  + install-package Google.Apis.Sheets.v4
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : NotSpecified: (:) [Install-Package],  Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

For some reason, the second API fails to install. 由于某些原因,第二个API无法安装。 I've recreated the project tons of times and every time I try to install a second API, it always returns this error message. 我已经无数次地重新创建了项目,并且每次尝试安装第二个API时,它总是返回此错误消息。

The reason I was getting an error is that my NuGet was outdated. 我收到错误消息的原因是我的NuGet已过时。 For some reason VS doesn't notify you, so I went to Tools>Extensions and Updates and selected NuGet and updated it. 由于某种原因,VS不会通知您,因此我转到“工具”>“扩展和更新”并选择了NuGet并对其进行了更新。 As soon as I tried again everything worked perfectly. 一旦我再次尝试,一切都会正常进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM