简体   繁体   中英

How do I install a package using OneGet / install-package from nuget.org

I am attempting to install the Microsoft.Experimental.IO library from here : https://www.nuget.org/packages/Microsoft.Experimental.IO/1.0.0 on Windows 10 using Powershell - Install-Package.

I have added the nuget.org repo and when I use the command "find-package -contains experimental " Powershell finds the package, but when i try to install it, I receive the following error.

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

How can I overcome this issue and install the package?

Well I fixed this, by using the following command : install-package -ProviderName nuget -Name Microsoft.Experimental.IO -Destination "C:\\Dev\\Lib\\Microsoft.Experimental.IO"

Which isnt the most intuitive, I've never had to use a destination field when using any other package manager in the past. I thought the whole point of a package manager was to standardise on paths and locations etc...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM