BuildMagic downloads NuGet packages on every build without requiring NuGet.exe or any other binaries to be comitted to your repository.

DISCLAIMER: this is experimental software that may not work as advertised. In particular, it has not been tested on Mono. Please help us improve it by sending feedback and fixes.

The Problem

If you are using NuGet the current recommended practice is to enable "package restore" feature that makes NuGet download packages during build, allowing you to leave the binaries out of the source control repository.

Unfortunately, there is a small problem. You still have to commit the 600K NuGet.exe file. Moreover, you will have to commit new versions of it every time NuGet itself changes.

The Solution

Enter BuildMagic. This little package bootstraps NuGet.exe by downloading and unpacking it, then proceeds to use it to restore packages. Downloading and unpacking is implemented as MSBuild inline C# tasks. With BuildMagic you still have to commit an extra .targets file to your repository, but you do not have to commit any binaries.


Use NuGet to add BuildMagic to your solution. Ignore the .nuget/bin folder but commit .nuget/BuildMagic.targets to source control. Your build should now succeed on the build server or hosted environment like AppHarbor without comitting any NuGet package binaries or NuGet.exe.

Source Code

The source code repository is:

To build, run NuGet.exe pack.

Bugs and Feedback

Please use the issues tracker at:


The PowerShell script is inspired by Daniel Cazulino's blog. When constructing the MSBuild code the NuGet.Build targets responsible for NuGet package restore were a helpful reference.