PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
483 stars 92 forks source link

NuGet v3 Repositories should not require tags element #1445

Closed JustinGrote closed 4 months ago

JustinGrote commented 11 months ago

Prerequisites

Steps to reproduce

Attempt to install a package from a NuGet v3 repository.

However, per the NuGet v3 spec, tags is an optional property, and PSResourceGet should handle the case where tags is present and ignore the tags-based search: https://learn.microsoft.com/en-us/nuget/api/registration-base-url-resource#catalog-entry

Expected behavior

Installs package

Actual behavior

Install-PSResource: Response does not contain 'tags' element for search with Name 'az.accounts' in 'pwshgallery'.

Error details

Exception             :
    Type    : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
    Message : Package(s) 'az.accounts' could not be installed from repository 'pwshgallery'.
    HResult : -2146233088
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
CategoryInfo          : InvalidData: (Microsoft.PowerShel…s.InstallPSResource:InstallPSResource) [Install-PSResource],
ResourceNotFoundException
FullyQualifiedErrorId : InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
InvocationInfo        :
    MyCommand        : Install-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 6
    Line             : install-psresource az.accounts -Repository pwshgallery -verbose -debug
    PositionMessage  : At line:1 char:1
                       + install-psresource az.accounts -Repository pwshgallery -verbose -debu …
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : install-psresource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.0.0                 Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PS…

Key   : PSVersion
Value : 7.3.8
Name  : PSVersion

Key   : PSEdition
Value : Core
Name  : PSEdition

Key   : GitCommitId
Value : 7.3.8
Name  : GitCommitId

Key   : OS
Value : Microsoft Windows 10.0.22631
Name  : OS

Key   : Platform
Value : Win32NT
Name  : Platform

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

SydneyhSmith commented 11 months ago

Thanks for opening this @JustinGrote -- looks like it might be an issue with the error message

SydneyhSmith commented 10 months ago

Thanks @JustinGrote looking at this further, want to confirm, was this the command you ran? install-psresource az.accounts -Repository pwshgallery -verbose -debug

And what is the output of Get-PSResourceRepository | fl *

JustinGrote commented 10 months ago

Correct, this is my nuget v3 bridge for PowerShell gallery. The destination is https://pwsh.gallery/index.json I do also want to note I pushed an update that has tags as a property but it is an empty array rather than not being present, which works around the issue but per the nuget spec, it should still be an optional property and may be a problem for other third-party v3 nuget repository compatibility

t-l-k commented 8 months ago

Quite the pickle, was hoping to use this newer module for its supposedly superior authentication mechanisms, but its not abiding by nuget specs. Attempting to use it with TeamCity, and its a no go. Not even the v2 endpoints work! PowershellGet v2.2.5 is so painful when used with authentication, but when used without appears to work "fine" v2/v3 (v3 pre-release semver issues not withstanding).

evelyn-bi commented 4 months ago

This might be closable now due to issue #1621 being closed since they have merged in this fix: https://github.com/PowerShell/PSResourceGet/pull/1627

anamnavi commented 4 months ago

This issue should be resolved via #1627 . If you still see an issue with this please feel free to comment and I can re-open, thanks @JustinGrote !