Controlling Nuget Package Install Folders

Topics: General
Jan 22, 2013 at 5:19 PM
Edited Jan 23, 2013 at 12:06 AM

The documentation states "Files in the content folder are copied to the root of your application when the package is installed", but I do not get that result on any package I try installing from the command line.  For example, I installed Modernizr.2.5.3 successfully, but the payload did not get copied to "the root" of my application.  Here is the command line I used:

c:\build\MySolution\.nuget\nuget install Modernizr -SolutionDirectory "C:\build\MySolution\MyProject" -OutputDirectory "C:\build\MySolution\runtime-packages"

This resulted in the payload being installed into the following location:


But, according to the documentation, the path I expected to see was this:


Notice how the "Content" subfolder doesn't appear in the "expected" path?

What went wrong?  I made a more detailed version of this question on SO.

Does the "content" folder not work correctly when a "packageID" is used for install?  Does it not work correctly when used from the command line?

Jan 23, 2013 at 10:35 PM

I think I found the answer to my question, quoting Balliauw:

Because the NuGet command line has no context for the solution or projects you might want to target, it will limit the install operation to the extraction of the package in a specific place.
Balliauw, Maarten; Decoster, Xavier (2012-03-07). Pro NuGet (Professional Apress) (Kindle Locations 1114-1115). Apress. Kindle Edition.

My take on this is (1) I invite the official documentation I previously linked to contain that quote and (2) I invite nuget authors to provide a new "-TargetDirectory" switch to the command-line tool so that it can optionally behave more like the nuget VS extension.