Stadub Dima
Stadub Dima

Reputation: 858

Azure DevOps yaml restore packages to specific directory

I have a monorepo with several solutions and trying to configure NuGet yaml to restore to the root directory. By defalut task: NuGetCommand@2 restores only in the .sln file directory but this will not work for me.

The UI pipelines version has parameter Folder which allows setting a path for packages path.

Is there any parameter for the yaml version?

I tried to set an environment variable - but it's doesn't work.

The yaml code fragment is:

- name: NUGET_PACKAGES
  value: $(build.SourcesDirectory)/

- task: NuGetCommand@2
  displayName: 'Nuget Restore '
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    nugetConfigPath: 'packages.config'
    verbosityRestore: 'Normal'

Upvotes: 1

Views: 2514

Answers (1)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41775

According to the docs you can use the parameter restoreDirectory:

Specifies the folder in which packages are installed. If no folder is specified, packages are restored into a packages/ folder alongside the selected solution, packages.config, or project.json.

Upvotes: 2

Related Questions