OneGet / NuGetProvider

NuGet Provider for OneGet. Works on Nano Server.
MIT License
31 stars 24 forks source link

Support Nuget API v3 #28

Open FranklinYu opened 6 years ago

FranklinYu commented 6 years ago

Microsoft prefer V3 over V2, and V3 seems to be registered in OneGet in fresh Windows 10.

ghost commented 5 years ago

Hi, news about this issue? Windows 10 fresh install: if you try to use one of the oneget cmdlet on nuget, no one works.

Use case:

PS C:\> Find-Package -ProviderName nuget | measure | select count
WARNING: Query Url https://nugetized.blob.core.windows.net/live-reload/index.json is invalid.

Count
-----
    0

The user is constrained to force the source to https://www.nuget.org/api/v2:

PS C:\> Find-Package -ProviderName nuget -Source https://www.nuget.org/api/v2 | measure | select count 

Count
-----
    106611

And this workaround is not even easy to discover...

liudonghua123 commented 3 years ago

I have the similar issue when I want to install ``

PS C:\Users\Liu.D.H> Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
msi                      3.0.0.0          AdditionalArguments
msu                      3.0.0.0
NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

PS C:\Users\Liu.D.H> Get-PackageSource

Name                             ProviderName     IsTrusted  Location
PSGallery                        PowerShellGet    False      https://www.powershellgallery.com/api/v2
nuget.org                        NuGet            False      https://api.nuget.org/v3/index.json

PS C:\Users\Liu.D.H> Install-Package squirrel.windows  -verbose
VERBOSE: Using the provider 'Programs' for searching packages.
VERBOSE: Using the provider 'msu' for searching packages.
VERBOSE: Using the provider 'msi' for searching packages.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: Using the provider 'NuGet' for searching packages.
''.
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'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='squirrel.windows'' for
''.
VERBOSE: Total package yield:'0' for the specified package 'squirrel.windows'.
Install-Package : No match was found for the specified search criteria and package name 'squirrel.windows'. Try
Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS C:\Users\Liu.D.H> Find-Package squirrel.windows -Source https://www.nuget.org/api/v3
Find-Package : Unable to find package source 'https://www.nuget.org/api/v3'. Use Get-PackageSource to see all
available package sources.
At line:1 char:1
+ Find-Package squirrel.windows -Source https://www.nuget.org/api/v3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exceptio
   n
    + FullyQualifiedErrorId : SourceNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

PS C:\Users\Liu.D.H> Find-Package squirrel.windows -Source https://api.nuget.org/v3/index.json
Find-Package : No match was found for the specified search criteria and package name 'squirrel.windows'. Try
Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Find-Package squirrel.windows -Source https://api.nuget.org/v3/index. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exceptio
   n
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

PS C:\Users\Liu.D.H> Find-Package squirrel.windows -Source https://www.nuget.org/api/v2

Name                           Version          Source                           Summary
----                           -------          ------                           -------
squirrel.windows               2.0.1            https://www.nuget.org/api/v2     An installation and update framewor...

PS C:\Users\Liu.D.H> Install-Package squirrel.windows  -verbose    -Source https://www.nuget.org/api/v2
VERBOSE: Using the provider 'NuGet' for searching packages.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='squirrel.windows'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'squirrel.windows'.
VERBOSE: Performing the operation "Install Package" on target "Package 'squirrel.windows' version '2.0.1' from
'https://www.nuget.org/api/v2'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'https://www.nuget.org/api/v2'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='squirrel.windows'' for ''.
Install-Package : Administrator rights are required to install packages in 'C:\Program
Files\PackageManagement\NuGet\Packages'. Log on to the computer with an account that has Administrator rights, and
then try again, or install in 'C:\Users\Liu.D.H\AppData\Local\PackageManagement\NuGet\Packages' by adding "-Scope
CurrentUser" to your command. You can also try running the Windows PowerShell session with elevated rights (Run as
Administrator).
At line:1 char:1
+ Install-Package squirrel.windows  -verbose    -Source https://www.nug ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (InvalidOperation:String) [Install-Package], Exception
    + FullyQualifiedErrorId : InstallRequiresCurrentUserScopeParameterForNonAdminUser,Microsoft.PowerShell.PackageMana
   gement.Cmdlets.InstallPackage

PS C:\Users\Liu.D.H> Install-Package squirrel.windows  -verbose    -Source https://www.nuget.org/api/v2 -Scope CurrentUser
VERBOSE: Using the provider 'NuGet' for searching packages.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='squirrel.windows'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'squirrel.windows'.
VERBOSE: Performing the operation "Install Package" on target "Package 'squirrel.windows' version '2.0.1' from
'https://www.nuget.org/api/v2'.".

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'https://www.nuget.org/api/v2'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='squirrel.windows'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='DeltaCompressionDotNet'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Mono.Cecil'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='SharpCompress'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='NETStandard.Library'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.NETCore.Platforms'' for
''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Runtime.InteropServices.RuntimeInformation'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.NETCore.Targets'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.IO'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Runtime'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.NETCore.Platforms'' for
''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.NETCore.Targets'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Text.Encoding'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Threading.Tasks'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection.Primitives'' for
''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Reflection.Extensions'' for
''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Resources.ResourceManager''
for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Globalization'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Threading'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.native.System'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Runtime.InteropServices'' for
 ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Runtime.Handles'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Win32.Primitives'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.AppContext'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Collections'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Console'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.NETCore.Targets'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Globalization.Calendars'' for
 ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.IO.Compression'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.native.System.IO.Compression'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Buffers'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Diagnostics.Debug'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Diagnostics.Tracing'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Runtime.Extensions'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Runtime'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.IO.Compression.ZipFile'' for
''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.IO.FileSystem'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.IO.FileSystem.Primitives''
for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Net.Http'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Security.Cryptography.X509Certificates'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Security.Cryptography.Algorithms'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Security.Cryptography.Primitives'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Security.Cryptography.Encoding'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.native.System.Security.Cryptography.OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.debian.8-x64.runtime.native.System.Security.Cryptography.O
penSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.debian.9-x64.runtime.native.System.Security.Cryptography.O
penSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.
OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.
OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.
OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.
OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptogra
phy.OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptogra
phy.OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptogra
phy.OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.
OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.Ope
nSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptograp
hy.OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptograp
hy.OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptograp
hy.OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptograp
hy.OpenSsl'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Collections.Concurrent'' for
''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Linq'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.native.System.Security.Cryptography.Apple'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.
Apple'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.native.System.Security.Cryptography.OpenSsl'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Runtime.Numerics'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Security.Cryptography.Cng''
for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.NETCore.Platforms'' for
''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='runtime.native.System.Net.Http'' for
 ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Security.Cryptography.Csp''
for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Security.Cryptography.OpenSsl'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Diagnostics.DiagnosticSource'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Memory'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Buffers'' for ''.
VERBOSE: Searching repository
'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Runtime.CompilerServices.Unsafe'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='System.Numerics.Vectors'' for ''.
VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='NETStandard.Library'' for ''.
Install-Package : Dependency loop detected for package 'squirrel.windows'.
At line:1 char:1
+ Install-Package squirrel.windows  -verbose    -Source https://www.nug ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : Deadlock detected: (squirrel.windows:String) [Install-Package], Exception
    + FullyQualifiedErrorId : DependencyLoopDetected,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS C:\Users\Liu.D.H>

Expected behavior Installation success.

Actual behavior Installation failed.

Additional information

C:\Users\Liu.D.H>ver

Microsoft Windows [Version 10.0.19041.508]

C:\Users\Liu.D.H>

PS C:\Users\Liu.D.H> $PSversionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS C:\Users\Liu.D.H> (Get-WmiObject Win32_OperatingSystem).Version
10.0.19041
PS C:\Users\Liu.D.H>