【问题标题】:How to authenticate with private nuget package source while running dotnet restore如何在运行 dotnet restore 时使用私有 nuget 包源进行身份验证
【发布时间】:2021-08-16 23:20:44
【问题描述】:

我正在尝试在命令行上运行 dotnet restore --configfile NuGet.config my-solution.sln 以从私有 nuget 源恢复包,但我无法使用私有 nuget 进行身份验证,并且出现此错误:

Retrying 'FindPackagesByIdAsyncCore' for source 'http://my.private.nuget/source/FindPackagesById()?semVerLevel=2.0.0'.
Response status code does not indicate success: 401 (Unauthorized).

但是我能够从visual studio 成功恢复包,当我尝试从visual studio 恢复包时,我收到了要求提供凭据的提示,并且在添加凭据后恢复正确。

当我通过命令行恢复时,我正在尝试找出需要在哪里添加私有 nuget 的凭据。

【问题讨论】:

  • 你试过传递--interactive吗?
  • 不,你能告诉我如何通过 --interactive 和 dotnet restore @kit
  • 在你的情况下是dotnet restore --configfile NuGet.config my-solution.sln,但我建议查看其他评论者发布的问题。
  • --交互式没有帮助。我已经回答了我自己的问题,即如何在不安装任何东西的情况下解决它

标签: c# .net nuget


【解决方案1】:

我通过在 Nuget.config 文件中添加我的 nuget 凭据来解决此问题,请参阅此 link 看看如何正确地格式化你的Nuget.config 文件,就像nuget 4.6 和下面有一个不同的格式来添加凭据到Nuget.config,而不是新版本。

【讨论】:

    猜你喜欢
    • 2019-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-25
    • 2020-08-17
    • 1970-01-01
    • 2013-09-12
    相关资源
    最近更新 更多