3

We are using VS 2015 and VSO. Nuget package restore isn't working for us which forced us to checking 20+ nuget package dlls (bad practice).

I tried to enable the nuget package restore on VSO by following a link below.

How to enable nugets package restore in Visual Studio 2015?

https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore

But the package restore doesn't seem to be working. And I don't how would it work without executing the nuget.exe.

Could someone please share whether you got it working and how.

Community
  • 1
  • 1
Nil Pun
  • 16,019
  • 34
  • 150
  • 277

1 Answers1

1

Checking NuGet packages into Version Control is not a good idea. You need to remove them, and then use NuGet restore:

If you work with the vNext build system in VSO, all you need to do is to check the Restore NuGet Packages checkbox in the build definition, and choose the .sln file you would like to build.

enter image description here

If you work with one XAML build definition, there are some steps (described here) you need to follow in order to have these NuGet packages restored during the VSO (TFS) build process.

  1. Add following items to the solution. (Content of the nuget.config and .tfignore file can be found here)

enter image description here

  1. Add one build.proj file under the root path of the solution folder. (Content of the build.proj file can be found here)

  2. Create one folder named tools under the root path of the solution folder. Create NuGet sub-folder under tools folder, download and save nuget.exe under tools\NuGet path.

  3. Check in nuget.config, .tfignore, build.proj and tools\NuGet\nuget.exe into TFS version control.

  4. Modify the build definition to choose to build the build.proj file. enter image description here

Then you will have NuGet packages restored successfully during the TFS build process.

Community
  • 1
  • 1
Vicky - MSFT
  • 4,835
  • 1
  • 10
  • 22
  • I can repro this with local builds as well as in our visual studio online builds. So far the only projects we have this issue with is vso projects. Event projects that didnt originate in VSO, but when used as a remote. Its very easy to repro it seems. Before you say .ignore file, we can confirm our nuget packges are not in the repository, and never were – Rex Whitten Oct 25 '16 at 00:09
  • The "build.proj file" link in your answer (http://docs.nuget.org/consume/package-restore/team-build) now redirects to https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#package-restore-with-team-foundation-build. A cached version of the page you linked to from november 2015 can be found here: https://web.archive.org/web/20151110073248/http://docs.nuget.org/consume/package-restore/team-build – Frank van Eykelen May 17 '17 at 12:25