10

According to the NuGet documentation:

Update Command

Update packages to latest available versions. This command also updates NuGet.exe itself.

Usage nuget update <packages.config|solution>

Options:

Id - Package ids to update.

This says that the ID option is the package IDs to update. How do you provide multiple ID's?

This works:

NuGet.exe update "MySln.sln" -RepositoryPath "MyRepoPath" -id Ref1

...but how do you also udpate Ref2? This fails:

NuGet.exe update "MySln.sln" -RepositoryPath "MyRepoPath" -id Ref1,Ref2

I am trying to update a subset of packages and prevent the need for a large number of calls to NuGet.exe.

infojolt
  • 5,244
  • 3
  • 40
  • 82

1 Answers1

11

You can specify the -id option several times:

NuGet.exe update "MySln.sln" -RepositoryPath "MyRepoPath" -id Ref1 -id Ref2
Julian
  • 20,008
  • 17
  • 77
  • 108
  • 2
    It seems to me that this only works if all the projects in the solution include both Ref1 and Ref2. Is there a way to allow for the fact that some projects do not? – Klas Mellbourn May 20 '13 at 14:52
  • @Kias_Mellbourn Nuget.exe update should only update packages that are in a project's packages.config folder - it shouldn't install packages that aren't there. It may throw up warnings on the command line but should still work. – NextInLine Jan 29 '15 at 15:28
  • 3
    If project has Ref1 but not Ref2, the warning will be about Ref2 and then no update will be applied for Ref1. – Gareth A. Lloyd Jun 23 '15 at 10:01
  • I tried this and specified about 7 Ids, but it didn't work. It only picked up the first two and ignored the rest. – C.J. Jul 10 '18 at 20:14