41

According to the page at: https://dist.nuget.org/index.html

NuGet 4.x is included in the Visual Studio 2017 installation. Latest NuGet releases are delivered as part of Visual Studio updates.

Batteries are included!

No matter whether I open a Visual Studio 2017 command prompt or the Nuget console itself, running the 'nuget' command results in command not found.

How can I run the nuget CLI with Visual Studio 2017? What am I missing?

Mike Cheel
  • 12,626
  • 10
  • 72
  • 101
  • Yes, it is available through the context menus. An add-in, not a separate executable. Why you want to run it from the command prompt is not clear, better if you don't. Use the [install guide](https://learn.microsoft.com/en-us/nuget/guides/install-nuget), version 4.1.0 looks attractive. – Hans Passant Apr 10 '17 at 16:33
  • 1
    So you have to run the Install-Package Nuget.CommandLine to get it? I'm guessing the project's framework target needs to be >= 4.5 as well? – Mike Cheel Apr 10 '17 at 16:37
  • 2
    Also I want to use the CLI for creating a package (which i was able to do with a 3.5 version I found on my system). – Mike Cheel Apr 10 '17 at 16:39
  • Use Package Manager Console to access the nuget CLI within VS, after you install that package. – escape-llc Jul 21 '17 at 12:46
  • 2
    @HansPassant One reason to run it is to get through this tutorial: https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package – Steve Smith Aug 01 '17 at 15:59

3 Answers3

22

Although it says "Batteries are included" on the page you have mentioned, that only refers to how the NuGet package manager is integrated with Visual Studio 2017. The other downloads on that page are for Visual Studio 2013-2015.

If you want the command line nuget.exe in order to create NuGet packages, that is still a separate download on the page you mentioned: https://dist.nuget.org/index.html

Matt Frear
  • 52,283
  • 12
  • 78
  • 86
  • For Visual Studio 2019, you still must download the `nuget.exe` CLI program. Just FYI, to run it you must place it into a folder that is on your path or in a folder of your choosing. If you place it into a folder that is not on your path, then you must add that folder to your path or specify the entire path when running it. Running nuget.exe without any arguments will show help info. This article will also help: https://learn.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-visual-studio-net-framework – qxotk May 13 '23 at 11:24
2

To use NuGet CLI, download the nuget.exe from https://www.nuget.org/downloads page Windows x86 Commandline section. Add the folder where you placed nuget.exe to your PATH environment variable. Open the command window or powershell anywhere and run any nuget command. Or you can use directly from the Visual Studio 2017 package manager console. (Visual Studio restart is required to get the PATH environment variable.) Here is the MS Docs for NuGet CLI

Madhu
  • 574
  • 7
  • 14
0

I think it is easier to recreate the assembly using a new project template called .NET Standard in Visual Studio 2017.

When I tried to change the old .csproj file, I broke the assembly.

Then I followed the instructions from this link Quickstart: Create and publish a NuGet package using Visual Studio (Windows only).

I hope this link will also help: NuGet is now fully integrated into MSBuild

  • I was use this link [NuGet is now fully integrated into MSBuild](http://blog.nuget.org/20170316/NuGet-now-fully-integrated-into-MSBuild.html). It's work fine. – Арсений Савин Apr 22 '17 at 04:36
  • 3
    This only seems to work with .Net Core projects. http://blog.nuget.org/20170316/NuGet-now-fully-integrated-into-MSBuild.html#what-about-other-project-types-that-are-not-net-core – Steve Smith Aug 01 '17 at 16:01