简体   繁体   中英

How to install package from NuGet

I'm trying to install this package from NuGet.

Install-PackageProvider -Name NuGet

if(Get-PackageProvider -Name NuGet -ea SilentlyContinue)
{
    Install-Package -Name "Google.Apis.Sheets.v4" -Source NuGet -MinimumVersion "1.54.0.2371"
}

But i get this error:

Install-Package : Dependency loop detected for package 'Google.Apis.Sheets.v4'.
At line:5 char:5
+     Install-Package -Name "Google.Apis.Sheets.v4" -Source NuGet
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : Deadlock detected: (Google.Apis.Sheets.v4:String) [Install-Package], Exception
    + FullyQualifiedErrorId : DependencyLoopDetected,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

What i'm doing wrong, and how to properly install packages from NuGet? PowerShell version: 5.1

If you can't install the package from CLI, you can directly add this

<PackageReference Include="Google.Apis.Sheets.v4" Version="1.54.0.2371" /> in your <project_name>.csproj file. This approach worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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