【问题标题】:Can't add nuget package with dotnet core无法使用 dotnet core 添加 nuget 包
【发布时间】:2019-02-19 23:31:22
【问题描述】:

我正在尝试使用 dotnet core CLI 和以下命令安装 xunit NuGet 包:

dotnet add package xunit -s https://api.nuget.org/v3/index.json

从类库文件夹中。但是,我在执行该行时看到了这一点:

  Writing C:\Users\<myuser>\AppData\Local\Temp\tmp7238.tmp
info : Adding PackageReference for package 'xunit' into project 'C:\git\Testing\TestLib\TestLib.csproj'.
log  : Restoring packages for C:\git\Testing\TestLib\TestLib.csproj...
info :   CACHE https://api.nuget.org/v3-flatcontainer/xunit/index.json
error: Unable to load the service index for source https://<mysourcecontrol>.pkgs.visualstudio.com/_packaging/libs/nuget/v3/index.json.
error:   Response status code does not indicate success: 401 (Unauthorized).

AFAIK 这告诉我,我机器上的 nuget 实用程序无法找到有关我们本地 NuGet 源的相关信息。我不明白为什么这甚至是一个问题 - 我正在指定要使用的源(这是常规的 nuget.org 路径)。

【问题讨论】:

    标签: .net-core nuget-package


    【解决方案1】:

    原来%appdata%\nuget\nuget.config 有 NuGet 工具不喜欢的条目。我删除了它们并重试,安装成功了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-20
      • 2017-11-30
      • 2017-08-10
      • 2021-05-06
      相关资源
      最近更新 更多