Yaroslav Yakovlev
Yaroslav Yakovlev

Reputation: 6483

nuget update script for all projects in the solution

I need to upgrade several projects in VS2013 solution. There are lot of libraries, that depend on each other and a lot of projects in the solution. I don't want to upgrade it all manually. And I don't want to upgrade all so I cant use update all button in "manage nuget packages". What are my options? Ideally I would like to be able to set a list of libraries I want to update. And run a script that would check every project against this list and make updates. Is there a nuget api for that?

Upvotes: 2

Views: 755

Answers (1)

Matt Ward
Matt Ward

Reputation: 47907

I would write a PowerShell script and then run it from the Package Manager Console. You can update all packages in a specific project by using the Update-Package command:

Update-Package -Project MyProject

You can also just update specific packages in a project:

Update-Package MyPackage -Project MyProject

Or you can update specific packages for the entire solution:

Update-Package MyPackage

I would also have everything under source control so you can rollback if the script updated the wrong thing.

Upvotes: 2

Related Questions