Restore NuGet packages from packages.config

Another in my occasional series of wrangling with NuGet within Visual Studio.

This one is to restore all packages from a packages.config file:

function Restore-Packages() {
  $proj = get-project
  get-package -project $ | % {
    Write-Host $;
    uninstall-package -projectname $ -id $ -version $_.version -RemoveDependencies -force ;
    install-package -projectname $ -id $ -version $_.version

To use, first edit the packages.config as you require. Then, in the Package Manager Console in VS (in the ‘default project’ dropdown set correctly), just type:



About these ads

Posted on May 13, 2013, in Uncategorized and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 292 other followers