azure-devops - 在 Azure 上的 nuget 还原步骤中来自特定包源的 Nuget 包
问题描述
我要恢复的包同时nuget.org
位于3rd party myget
. 第 3 方是我想使用的更高版本(预发布),但它似乎甚至没有尝试找到这个包的 myget 源,因为它在 nuget.org 上找到了包,除了我想要的版本之外以下错误消息:
##[error]The nuget command failed with exit code(1) and error(Errors in packages.config projects
Unable to find version '2.0.0-dev-00013' of package 'Discord.Addons.Interactive'.
https://api.nuget.org/v3/index.json: Package 'Discord.Addons.Interactive.2.0.0-dev-00013' is not found on source 'https://api.nuget.org/v3/index.json'.)
myget 在我的 nuget.config 中正确配置,它位于我的解决方案根目录中
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Foxbot" value="https://www.myget.org/F/foxbot-discord-addons/api/v3/index.json" />
</packageSources>
</configuration>
我将如何让 nuget 恢复步骤尊重这个包的 myget 包源?
解决方案
我将如何让 nuget 恢复步骤尊重这个包的 myget 包源?
对于nuget restore
任务,有一个选项用于控制在包还原期间使用哪些提要。
查看要使用的提要:
与本地恢复包不同,解决方案目录(Devops Repos)中的文件在我们检查该选项nuget.config
之前将不起作用。Feeds in my Nuget.config
所以在这个过程中,nuget 实际上没有使用你的nuget.config
文件package source
,这导致了这个问题:
解决方法:
像下面这样配置提要,Nuget.config
以确保 nuget 将使用您Nuget.config
在解决方案目录中的文件:
另外:如果你使用的是yaml格式而不是经典格式,你应该设置feedsToUse: 'config'
和nugetConfigPath: 'path/NuGet.config'
。
推荐阅读
- python - Jupyter 仪表板显示/渲染问题 - 小部件重叠
- php - MySQL 查询没有显示结果
- jquery - JSON 中位置 1 的意外标记 o 或无法读取未定义的属性“0”
- unity3d - Unity Particles 不适用于自定义脚本
- javascript - Nuxt 子路由重新渲染整个页面
- url - 我可以修改浏览器使其只能访问一个网站吗?
- python - 在其中访问 Jupyter Noteook 的 JSON
- go - 查找整数位数的最快方法?
- autodesk-forge - 映射到 Forge Viewer
- flutter - 如何让 Flutter Widget 在特定时间(以天为单位)后消失?