为什么 Visual Studio 需要安装 nuget?

Why is Visual Studio required to install nuget?

我刚刚在代理后面安装了巧克力

$env:chocolateyProxyLocation = 'http://proxy.com:port'
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

并且正在尝试安装 nuget 包管理器

choco install nugetpackagemanager

为什么 nuget 需要 VS?我收到此错误:

 Chocolatey v0.10.13
Installing the following packages:
nugetpackagemanager
By installing you accept licenses for the packages.
Progress: Downloading NugetPackageManager 2.8.60318.667... 100%

NugetPackageManager v2.8.60318.667 [Approved]
nugetpackagemanager package files install completed. Performing other installation steps.
The package NugetPackageManager wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[N]o/[P]rint): y

ERROR: Visual Studio is not installed or the specified version is not present.
The install of nugetpackagemanager was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\NugetPackageManager\tools\chocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - nugetpackagemanager (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\NugetPackageManager\tools\chocol
ateyInstall.ps1'.
 See log for details.

您是否有 link 到您要安装的实际应用程序? NuGet 包管理器通常是安装到 Visual Studio 中的应用程序(它后来被烘焙到 Visual Studio 安装中)。因此,要安装此软件包:

https://chocolatey.org/packages/NugetPackageManager

您将需要安装 Visual Studio,因为此工具设计用于在 Visual Studio 内工作。

如果您实际上是在尝试安装 NuGet.exe,那么您使用了错误的软件包,您应该改用这个软件包:

https://chocolatey.org/packages/NuGet.CommandLine

或此处的 NuGet 包资源管理器:

https://chocolatey.org/packages/NugetPackageExplorer

更新:

关于评论:

The package provider requires 'PackageManagement' and 'Provider' tags.

在此上下文中,PackageManagement 不是指 NuGet 包管理器,而是指:

https://www.powershellgallery.com/packages/PackageManagement/1.1.7.0

以前称为 OneGet。