user3634685
user3634685

Reputation: 591

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

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?

Upvotes: 6

Views: 9714

Answers (3)

timB33
timB33

Reputation: 1987

The nuget team changed the way that nuget restores packages. You used to have to enable restore against your sln, which modded your csproj's; this is what the deprecated "restore nuget packages" does. Now, you use the nuget task/step before building the sln.

See: http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html

Upvotes: 0

gregsonian
gregsonian

Reputation: 1226

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.

Upvotes: 6

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51143

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.

Upvotes: 6

Related Questions