0

We have a number of VS2013 solutions, with the "Enable NuGet package restore" option selected. Remembering back, selecting this option creates a ".nuget" solution folder containing a number of files (NuGet.config, NuGet.exe, NuGet.targets). As a final step, I would edit the NuGet.targets file to add a package source for our in-house repo.

I've just upgraded our old TFS2012 server to Azure DevOps 2019 and am currently creating new build pipelines to replace our old XAML-based build definitions. I've added a "NuGet restore" task, but I'm not sure if this is necessary given that our solutions have the "package restore" option enabled? If I remove this task, will the packages be restored by the "Visual Studio build" task instead?

I never really liked having all that package restore stuff in the solution. If I was to remove it, I guess the "NuGet restore" build task would be needed after all? But without the package restore option, how would a developer restore the packages on their PC (in VS2019)?

Andrew Stephens
  • 9,413
  • 6
  • 76
  • 152

1 Answers1

1

The best practice is to make two tasks in the build pipeline - restore and build.

The option "Enable NuGet package restore" does not exist anymore from VS2015, so how the developer restore the packages? just right-click on the solution and "Restore NuGet Packages:

enter image description here

In fact, VS should do it automatically when you build, if not check this setting (under Tools - Options):

enter image description here

You need to add your private NuGet feed to the NuGet sources (Tools - Options):

enter image description here

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114