'nuget' is not recognized but other nuget commands working

There are much nicer ways to do it.

  1. Install Nuget.Build package in you project that you want to pack. May need to close and re-open solution after install.
  2. Install nuget via chocolatey - much nicer. Install chocolatey: https://chocolatey.org/, then run

    cinst Nuget.CommandLine

in your command prompt. This will install nuget and setup environment paths, so nuget is always available.


In [Package Manager Console] try the below

Install-Package NuGet.CommandLine

Nuget.exe is placed at .nuget folder of your project. It can't be executed directly in Package Manager Console, but is executed by Powershell commands because these commands build custom path for themselves.

My steps to solve are:

  • Download NuGet.exe from https://github.com/NuGet/NuGet.Client/releases (give preference for the latest release);
  • Place NuGet.exe in C:\Program Files\NuGet\Visual Studio 2012 (or your VS version);
  • Add C:\Program Files\NuGet\Visual Studio 2012 (or your VS version) in PATH environment variable (see http://www.itechtalk.com/thread3595.html as a How-to) (instructions here).
  • Close and open Visual Studio.

Update

NuGet can be easily installed in your project using the following command:

Install-Package NuGet.CommandLine