Search code examples
azure-devopsartifactory

How to restore packages from Artifactory using YAML


The guide here gives the example code below:

- task: DotNetCoreCLI@2
  inputs:
    command: restore
    projects: '**/*.csproj'
    feedsToUse: config
    nugetConfigPath: NuGet.config    # Relative to root of the repository
    externalFeedCredentials: <Name of the NuGet service connection>

but I'm struggling to know what is required in place of <Name of the NuGet service connection> or even NuGet.config.

The Guide on Artifactory doesn't use YAML or even mention it so I don't know if it is even possible.

My question: Is the above possible, and if so, what should I have in the script above?


Solution

  • <Name of the NuGet service connection> is exactly what it says. Go create a service connection in your project that points to the NuGet feed, then reference it by name there.