Skip to content

Instantly share code, notes, and snippets.

@vbfox
Created November 19, 2014 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vbfox/6f619d0b69a0aeee4d5b to your computer and use it in GitHub Desktop.
Save vbfox/6f619d0b69a0aeee4d5b to your computer and use it in GitHub Desktop.
Update all Nuget packages in a solution matched by name

From my CoderWall: https://coderwall.com/p/gvrn4w

Here is a better version of the code already present on Coderwall and on the official bug tracker.

The complexity of the original one is too big as it tries to update all packages found for all projects, instead of just the packages present on each project.

This one is a lot quicker to update everything in a big solution :

ForEach($project in get-project -all) { ForEach($package in Get-Package -ProjectName $project.ProjectName | ?{ $_.Id -like 'MyCompany*'}) { Update-Package -ProjectName $project.ProjectName -Id $package.Id;} }

Source: https://coderwall.com/p/wtobfg
Source: https://nuget.codeplex.com/workitem/3621

ForEach($project in get-project -all) { ForEach($package in Get-Package -ProjectName $project.ProjectName | ?{ $_.Id -like 'MyCompany*'}) { Update-Package -ProjectName $project.ProjectName -Id $package.Id;} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment