Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Visual Studio keep it's own copy of nuget.exe?

I'd like to know where Visual Studio keeps it's copy of nuget.exe so that I can use that path in a custom msbuild target I'm planning to do.

Some time ago, NuGet package restore was not automatic in Visual Studio: you had to import a custom .targets file so that packages were restored before building. At the time, a copy of nuget.exe was kept with each solution in a .nuget folder. Nowadays, Visual Studio does this automatically when building, which indicates to me that somewhere there is a nuget.exe file that it uses to restore the packages for the solution.

Ideally I'd like to know it's path using MSBuild macros, because then it would not matter at which machine the projects are being built, the path will always point to the correct place.

For those who may be curious, I want to start distributing an internal library we have on a privage nuget feed, and intend to build the nupkg files using nuget.exe on build time. I know about NuGetter, but it is a bit more complex and inflexible than I wanted, so I feel a pure msbuild approach would be simpler to start with at least.

like image 721
julealgon Avatar asked Jan 27 '15 12:01

julealgon


People also ask

Where is NuGet exe stored?

The location of the default global packages folder. The default is %userprofile%\. nuget\packages (Windows) or ~/. nuget/packages (Mac/Linux).

Where should I save NuGet exe?

Each download is the nuget.exe file directly. Instruct your browser to save the file to a folder of your choice. The file is not an installer; you won't see anything if you run it directly from the browser. Add the folder where you placed nuget.exe to your PATH environment variable to use the CLI tool from anywhere.

Does Visual Studio install NuGet exe?

Note: nuget.exe itself is not included with any version of Visual Studio.


1 Answers

I'd like to know where Visual Studio keeps it's copy of nuget.exe

It doesn't have one. Nuget is an add-in, just DLLs. On my machine it is stored in the C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\clzwekqw.krr directory. The "clzwekqw.krr" part of the directory name is not going to repeat from one machine to the next, it was dynamically created. A basic mechanism to avoid having add-ins step on each other's toes.

You can get Nuget.exe, it is available through Nuget :) Obtain the Nuget.CommandLine package, the current version's project page is here. It will be installed as usual, in a subdirectory of your project. Currently packages\NuGet.CommandLine.2.8.3\tools, just the .exe

like image 118
Hans Passant Avatar answered Nov 09 '22 17:11

Hans Passant