【发布时间】:2018-02-27 02:16:09
【问题描述】:
我正在设置 VSTS 构建定义。构建定义很简单。步骤:
- 从 VSTS Git repo 的 master 分支获取源代码
- 恢复 nuget 包
- 运行 msbuild
第二步设置如下:
当我使用“我在此处选择的供稿”时,它只允许我选择一个供稿。这是一个错误吗?或者使用多个提要的唯一方法是通过 Nuget.config ?
【问题讨论】:
标签: nuget azure-devops azure-pipelines
我正在设置 VSTS 构建定义。构建定义很简单。步骤:
第二步设置如下:
当我使用“我在此处选择的供稿”时,它只允许我选择一个供稿。这是一个错误吗?或者使用多个提要的唯一方法是通过 Nuget.config ?
【问题讨论】:
标签: nuget azure-devops azure-pipelines
根据the docs,你有两种选择:
或
【讨论】:
我刚刚用我的yml 管道解决了这个问题,并花了一个小时查看文档。所以我想在这里写一个答案,因为从那时起事情发生了很大变化。
要走的路仍然是使用NuGet.config 文件。但这还不够。您还需要正确配置NuGetCommand@2 或DotNetCoreCLI@2 才能使用.config 文件。这是您配置它的方式:
- task: NuGetCommand@2
displayName: 'Restoring NuGet packages'
inputs:
restoreSolution: '**/*.sln'
feedsToUse: config
nugetConfigPath: NuGet.Config
- task: DotNetCoreCLI@2
displayName: Restoring NuGet packages
inputs:
command: restore
projects: '**/*.csproj'
feedsToUse: config
nugetConfigPath: NuGet.Config # Relative to root of the repository
您特别需要feedsToUse 属性具有config 的值。没有它,管道将不会使用您的 .config 文件。
【讨论】:
目前,它只能为 NuGet 还原任务中的“我在此处选择的提要”选项选择一个提要。
我为此功能创建了一个问题Enable to select multiple feeds in NuGet restore task Feed(s) I select here,您可以跟进。
目前的解决方法是使用 NuGet.config 文件,其中包含您需要使用的提要。或者添加您需要用作端点的 VSTS 提要,然后从 此帐户/集合之外的提要的凭据 选项中选择这些提要。
【讨论】: