Installing all NuGet package dependencies without Visual Studio

For the DeltaEngine we're using NuGet to manage our third-party dependencies.
The problem is that only 
Visual Studio 2010 Pro or Visual Studio 2012 (all editions) supporting automatic restore,
other IDE's like SharpDevelop or MonoDevelop are not supported.

By default you can install all references of a Visual Studio project inside a solution like this:

nuget.exe install project-folder\packages.config

However, normally you have more than one project inside a solution and all this "packages.config" references are aggregated inside a "packages\repositories.config" file like this:

<repositories>
  <repository path="..\Core\Tests\packages.config" />
</repositories>

Sadly, installing directly from a "repositories.config" like with a "packages.config is not possible Frown
To overcome this problem I created this little PowerShell script that iterate each reference inside the XML file and execute the install command for every "packages.config" file.
Note that you have to download and copy the nuget.exe commandline version from CodePlex and copy it inside the ".nuget" directory of your solution to make it work.
Now simply copy this script inside the root of you solution and execute it (look here if local script execution is disabled on you system):

Function InstallPackages($packagesConfigPath)
{
    $nugetInstallCmd = "..\.nuget\nuget.exe install ""{0}""" -f $packagesConfigPath
    Invoke-Expression $nugetInstallCmd
}

Function IterateRepositoriesAndInstall
{
    [xml]$repositoriesConfig = Get-Content .\repositories.config
    foreach( $repository in $repositoriesConfig.repositories.repository) 
    { 
        InstallPackages($repository.path)
    }
}

Function ShowInstallInstructions
{
    Write-Warning "nuget.exe not found! Pleas download the commandline version from ""http://nuget.codeplex.com/releases"" and copy it inside the "".nuget"" directory."
    Read-Host
}

Set-Location .\packages
if (Test-Path ..\.nuget\nuget.exe)
{
    IterateRepositoriesAndInstall
}
else
{
    ShowInstallInstructions
}

Powershell: The execution of scripts is disabled on this system

File Foo.ps1 cannot be loaded because the execution of scripts is disabled on this system.

If you get an error messag like this you have to change the ExecutionPolicy to Unrestricted to allow the execution of local scipts (run with admin rights):

PS C:\> Set-ExecutionPolicy Unrestricted

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): y
PS C:\>

That's it Smile