nuget - 无法访问 NuGet 源
问题描述
我正在尝试从私人来源添加 NuGet 包;https://[provider].pkgs.visualstudio.com/[package]/nuget/v3/index.json(故意省略了提供者和包)。
我已将源代码添加到项目中的本地 Nuget.Config 文件中
<configuration>
<packageSources>
<add key="[name]" value="https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<[name]>
<add key="Username" value="[username]" />
<add key="Password" value="[password]" />
</[name]>
</packageSourceCredentials>
</configuration>
当我通过 CLI 请求源列表时,我得到以下信息
Registered Sources:
1. [name] [Enabled]
https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json
2. nuget.org [Enabled]
https://api.nuget.org/v3/index.json
但是,当我尝试将特定包添加到我的项目时,我收到以下错误
error: Unable to load the service index for source https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json.
error: Response status code does not indicate success: 401 (Unauthorized).
自然的解释当然是我输入了无效的凭据。但是,当我在浏览器中访问源时,我可以使用相同的凭据登录并检查 index.json 文件。
我想知道在添加私有 NuGet 源的过程中是否会遗漏一些东西?
(NuGet 版本:4.9.3.5777)
解决方案
我刚刚发现我错过了什么。我需要安装 Azure Artifacts Credential Provider 并按照GitHub 页面上的说明进行操作。
推荐阅读
- tensorflow - 模块“tensorflow”没有属性“GPUOptions”
- pgadmin - 是否有一个 COPY 命令等效于在 pgAdmin 中取消选择其值是默认值的列?
- css - 如何在 CSS 中使用特定的选择器定义 @keyframes
- java - Mapbox - android studio中的onNavigationFinished()方法完成后不会将我发送到另一个活动
- sql-server - 有没有办法让 SQLServer 触发器与 Eloquent 查询一起工作?
- excel - 索引匹配跳过零值
- python - 有什么方法可以“将 *.sql 添加到 docker-entrypoint-initdb.d”并使用 alpine 在同一个 Dockerfile 中执行应用程序?
- woocommerce - WooCommerce 多供应商市场从产品 ID 获取供应商 ID
- sql - 找到交手次数最多的球队对
- amazon-web-services - ECS CPU/内存使用容器