【发布时间】:2021-06-23 19:27:32
【问题描述】:
我正在尝试将第三方 NuGet 包(例如 StyleCop)安装到项目中。该项目还包含从我们自己的私有 NuGet 源安装的包。尝试安装软件包时,我们收到这样的 401 错误。
MyProject> dotnet add .\MyProject.csproj package StyleCop
Determining projects to restore...
Writing C:\Users\me\AppData\Local\Temp\tmp6A51.tmp
info : Adding PackageReference for package 'StyleCop' into project '.\MyProject.csproj'.
info : CACHE https://api.nuget.org/v3/registration5-gz-semver2/stylecop/index.json
info : GET https://mediavaletsc.pkgs.visualstudio.com/_packaging/c559332f-5d8d-4d3f-8fc2-6e06125775fa/nuget/v3/registrations2-semver2/stylecop/index.json
info : Unauthorized https://mycompany.pkgs.visualstudio.com/_packaging/xxx-xxx-xxx-xxx-xxx/nuget/v3/registrations2-semver2/stylecop/index.json 680ms
error: Response status code does not indicate success: 401 (Unauthorized).
奇怪的是,运行 dotnet restore 运行良好,即使在运行 git clean -xfd 之后也是如此。我们如何配置dotnet 和/或nuget 以接受StyleCop 或任何其他公共包的安装?
【问题讨论】:
标签: authentication .net-core azure-devops nuget dotnet-cli