Skip to content

Instantly share code, notes, and snippets.

@rdkhatch
Created February 20, 2012 23:59
Show Gist options
  • Save rdkhatch/1872414 to your computer and use it in GitHub Desktop.
Save rdkhatch/1872414 to your computer and use it in GitHub Desktop.
Easily Restores Nuget Packages for a Solution - So you can exclude 'packages' folder from Source Control. (Much better than having Build Targets everywhere.)
@ECHO OFF
:: Installs all Nuget packages for all Projects, Recursively.
:: Ignores Resharper folders
:: DOS Help - http://www.dostips.com/forum/viewtopic.php?f=3&t=431
SET NUGET="Nuget.exe"
SET SOLUTIONDIR=..\src
ECHO.
ECHO Finding Projects in Solution... (saving to ProjectsUsingNuget.log.txt)
ECHO ------------------------------
DIR "%SOLUTIONDIR%\packages.config" /b /s | Find /I /V "_ReSharper" > ProjectsUsingNuget.log.txt
FOR /F "delims=" %%A In (ProjectsUsingNuget.log.txt) Do (
ECHO.
ECHO Updating Packages for Project:
ECHO ------------------------------
ECHO %%A
@ECHO ON
%NUGET% install "%%A" -OutputDirectory "%SOLUTIONDIR%\packages"
@ECHO OFF
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment