Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a NuGet package on the command line to a Visual Studio project

Tags:

I downloaded nuget.exe and I have tried the install. I would like to target a Visual Studio project so it adds a reference on the command line outside of Visual Studio. It is simply downloading the package with a version number on the end. MyOutputDirectory is the output directory which has a Visual studio solution there.

nuget install nhibernate -o MyOutputDirectory 
like image 955
Greg Finzer Avatar asked Jul 18 '13 20:07

Greg Finzer


People also ask

How do I import a NuGet package into a project?

Drop your NuGet package files in that folder. Go to your Project in Solution Explorer, right click and select "Manage NuGet Packages". Select your new package source.


1 Answers

The NuGet Command Line does not actually install any packages. The install command is actually doing a restore operation.

This means that nuget.exe install will only download and extract the package into the output location. It will not modify the project file (so no references are added, no content files injected, no transformations applied, no MSBuild files imported), and it will also not run any PowerShell scripts.

I do believe that a similar request to yours is being tracked by the NuGet team, but feel free to log an issue there: http://nuget.codeplex.com.

To answer your question: the NuGet Command Line does not support your scenario at this moment (nuget.exe v2.8).

like image 141
Xavier Decoster Avatar answered Oct 22 '22 14:10

Xavier Decoster