Visual Studio 2017 中的 Nuget CLI - 如何 运行?

Nuget CLI in Visual Studio 2017 - How to run?

根据页面: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!

无论我是打开 Visual Studio 2017 命令提示符还是 Nuget 控制台本身,运行使用 'nuget' 命令都会导致找不到命令。

如何使用 Visual Studio 2017 运行 nuget CLI?我错过了什么?

我认为在 Visual Studio 2017 年使用新解决方案 .NET Standard 重新创建程序集会更容易。我尝试更改旧的 .csproj 文件。但是当我改变时,我破坏了装配。我使用了这个 link Create .NET standard packages with Visual Studio 2017. I hope this link NuGet is now fully integrated into MSBuild 帮助。

虽然在您提到的页面上说 "Batteries are included",但这仅指 NuGet 包管理器如何与 Visual Studio 2017 集成。该页面上的其他下载是 Visual Studio 2013-2015.

如果您想要命令行 nuget.exe 来创建 NuGet 包,那仍然是您提到的页面上的单独下载:https://dist.nuget.org/index.html

要使用 NuGet CLI,请从 https://www.nuget.org/downloads 页 Windows x86 命令行部分下载 nuget.exe。 将放置 nuget.exe 的文件夹添加到 PATH 环境变量中。 在任意位置打开命令 window 或 powershell,并在任何 nuget 命令中打开 运行。 或者您可以直接从 Visual Studio 2017 包管理器控制台使用。 (Visual Studio 需要重启才能获取 PATH 环境变量。) Here is the MS Docs for NuGet CLI