dante
dante

Reputation: 43

Installing Nuget packages form repository in VSTS

I have certain packages that are not available online. I am maintaining a package folder in my repo that holds all the packages required for the application to successfully build.

I am trying to figure out a way to install packages in VSTS build definition from the packages present in repo.

Thanks in advance.

Upvotes: 1

Views: 312

Answers (1)

starian chen-MSFT
starian chen-MSFT

Reputation: 33738

I recommend that you can store your packages in VSTS package feed. Then restore the packages from your VSTS feed.

  1. Publish your packages to your VSTS package feed. (Refer to Package Management in Team Services and TFS)
  2. Edit your build definition, specify config file for Nuget restore step or put NuGet.config at the solution root, next to the project.json file.

Regarding packages store in the repository scenario, you can clone that repository to the corresponding folder by using Command Line step/task;

  1. Edit your build definition
  2. Select Options
  3. Check Allow Scripts to Access OAuth Token
  4. Add Command Line step (Tool: [git tool path] (you can add nuget.exe to environment (system) variable), Arguments: clone https://:$(System.AccessToken)@[git repo url], Working folder: [folder that packages need to download]

On the other hand, if the project/solution file and package files are in the same repository, you just need to select corresponding repository in Repository tab of build definition.

Upvotes: 0

Related Questions