Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference using NuGet Installer task and "Restore Nuget Packages" in Visual Studio Build step?

Tags:

tfs

vnext

For TFS build (I use TFS 2017) should I use NuGet Installer task or use the Visual Studio Build step in the build configuration to restore all NuGet packages. Which is the preferred way to use it?

like image 940
user3634685 Avatar asked Jul 18 '17 14:07

user3634685


People also ask

What is NuGet package restore?

To promote a cleaner development environment and to reduce repository size, NuGet Package Restore installs all of a project's dependencies listed in either the project file or packages. config . The . NET Core 2.0+ dotnet build and dotnet run commands do an automatic package restore.

What is NuGet restore in TFS build?

With NuGet Package Restore you can install all your project's dependency without having to store them in source control. This allows for a cleaner development environment and a smaller repository size. You can restore your NuGet packages using the NuGet restore task, the NuGet CLI, or the . NET Core CLI.

How do I reinstall a NuGet package?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

Does dotnet restore use NuGet?

The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file. In most cases, you don't need to explicitly use the dotnet restore command, since a NuGet restore is run implicitly if necessary when you run the following commands: dotnet new.


2 Answers

At first, I was confused because I thought the NuGet Restore task before the build was where the error was coming from. The answer from Patrick-MSFT helped me find the correct answer but I am adding more information and context. Build Definition edit in TFS 2017

As you can see, the checkbox for the NuGet Restore is under the Build task, just like @Patrick-MSFT showed. What confused me, however, was before my Build task I had a NuGet Installer task with name NuGet restore. The unchecking the checkbox should remove the error.

like image 95
gregsonian Avatar answered Sep 28 '22 18:09

gregsonian


You'd better still use the NuGet Installer task during your build pipeline for now.

enter image description here

This option is deprecated. To restore NuGet packages, add a NuGet Installer step before the build.

You could also find related prompting message in Visual Studio Build task tutorial.

Restore NuGet Packages

(Important) This option is deprecated. Make sure to clear this checkbox and instead use the NuGet Installer build step.

like image 40
PatrickLu-MSFT Avatar answered Sep 28 '22 18:09

PatrickLu-MSFT