Reputation: 2134
I am in the process of setting up a VSTS build definition. The build definition is simple. Steps :
Step 2 is setup as following :
When I use "Feed(s) I select here", it only allows me to select one feed. Is this a bug ? Or the only way to use multiple feeds is through Nuget.config ?
Upvotes: 16
Views: 13481
Reputation: 5742
I just hit this with my yml
pipelines and spent an hour looking at the docs. So I thought on writing an answer here since things changed so much since then.
The way to go is still to use a NuGet.config
file. But that's not enough. You also need to properly configure the NuGetCommand@2
or DotNetCoreCLI@2
in order for it to use the .config
file. This is the way you configure it:
- 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
You need specifically the feedsToUse
property to have the value of config
. Without it, the pipeline will not use your .config
file.
Upvotes: 9
Reputation: 4445
As another work around, one could also choose to create a downstream feed that is only an aggregate of the upstream feeds and use the aggregate feed name in the build.
With this approach, it may be prudent to remove any non-admin users from having access to this feed to prevent packages being added to it directly.
Upvotes: 9
Reputation: 38096
For now, it can only select one feed for Feed(s) I select here option in NuGet restore task.
And I created an issue Enable to select multiple feeds in NuGet restore task Feed(s) I select here for this feature, you can follow up.
The workarounds for now is using the NuGet.config
file which contains the feeds you need to use. Or add the VSTS feeds you need to use as endpoints, and then select these feed from Credentials for feeds outside this account/collection option.
Upvotes: 2
Reputation: 32240
According to the docs, you have two options:
OR
Upvotes: 6