如何使用nuget.org中的OneGet / install-package安装软件包

时间:2016-03-16 11:53:32

标签: powershell installation nuget-package oneget

我正在尝试使用Powershell - Install-Package在Windows 10上安装Microsoft.Experimental.IO库:https://www.nuget.org/packages/Microsoft.Experimental.IO/1.0.0

我添加了nuget.org repo,当我使用命令" find-package -contains experimental " Powershell找到了包,但是当我尝试安装它时,我收到以下错误。

install-package Microsoft.Experimental.IO -verbose
VERBOSE: Skipping package provider provider 'NuGet'-- missing required option 'Destination'
VERBOSE: Skipping package provider provider 'NuGet'-- missing required option 'Destination'
VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2/' and PackageManagementProvider is 'NuGet'.
install-package : No match was found for the specified search criteria and package name 'Microsoft.Experimental.IO'.
At line:1 char:1
+ install-package Microsoft.Experimental.IO -verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

如何解决此问题并安装软件包?

1 个答案:

答案 0 :(得分:5)

我通过使用以下命令解决了这个问题: install-package -ProviderName nuget -Name Microsoft.Experimental.IO -Destination "C:\Dev\Lib\Microsoft.Experimental.IO"

哪个不是最直观的,我在过去使用任何其他包管理器时从未使用过目标字段。我认为包管理器的重点是标准化路径和位置等......