为什么需要Visual Studio安装nuget?

时间:2019-05-15 17:02:08

标签: chocolatey

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

$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.

1 个答案:

答案 0 :(得分:2)

您是否具有要尝试安装的实际应用程序的链接? 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

更新:

关于评论:

  

程序包提供者需要“ PackageManagement”和“ Provider”标签。

在这种情况下,PackageManagement不是指NuGet程序包管理器,而是:

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

以前被称为OneGet。