PowerShell / PSResourceGet

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

Install-PSResource doesn't find version for Microsoft.Graph.Users on local Reporsitory when Microsoft.Graph.Users.Actions is present #1648

Open FierlaPi opened 5 months ago

FierlaPi commented 5 months ago

Prerequisites

Steps to reproduce

I'm experiencing a problem with Install-PSResource and Find-PSResource when installing Microsoft.Graph.Users (currently version 2.18.0) when Microsoft.Graph.Users.Actions is also present in de repo.

The setup is done as follows:

Created a local file repository with the snippet:

Register-PSResourceRepository -Name 'Repo' -Uri \\server\Repo -Trusted -Priority 1

Save the Microsoft.Graph.Users and Microsoft.Graph.Users.Actions with snippet:

Save-PSResource -Name Microsoft.Graph.Users.Actions -Repository PSGallery -TrustRepository -Path \\server\Repo -AsNupkg
Save-PSResource -Name Microsoft.Graph.Users -Repository PSGallery -TrustRepository -Path \\server\Repo -AsNupkg

Expected behavior

PS> Install-PSResource Microsoft.Graph.Users -Repository Repo
PS> Find-PSResource Microsoft.Graph.Users

Name                  Version Prerelease Repository Description
----                  ------- ---------- ---------- -----------
Microsoft.Graph.Users 2.18.0             Repo       Microsoft Graph PowerShell Cmdlets
Microsoft.Graph.Users 2.18.0             PSGallery  Microsoft Graph PowerShell Cmdlets

Actual behavior

PS> Install-PSResource Microsoft.Graph.Users -Repository Repo
Install-PSResource: Could not parse version actions.2.18.0 from file Microsoft.Graph.Users.Actions.2.18.0.nupkg
Install-PSResource: Package(s) 'Microsoft.Graph.Users' could not be installed from repository 'Repo'.

PS> Find-PSResource Microsoft.Graph.Users

Name                  Version Prerelease Repository Description
----                  ------- ---------- ---------- -----------
Microsoft.Graph.Users 2.18.0             PSGallery  Microsoft Graph PowerShell Cmdlets

Error details

PS> Get-Error 

Exception             : 
    Type    : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
    Message : Package(s) 'Microsoft.Graph.Users' could not be installed from repository 'Repo'.
    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        : 65
    Line             : Install-PSResource Microsoft.Graph.Users -Repository Repo
    Statement        : Install-PSResource Microsoft.Graph.Users -Repository Repo
    PositionMessage  : At line:1 char:1
                       + Install-PSResource Microsoft.Graph.Users -Repository Repo
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Install-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : 
      0
      1

Environment data

PS> Get-Module Microsoft.PowerShell.PSResourceGet; $PSVersionTable | Format-Table

Name                               Version PreRelease ExportedCommands
----                               ------- ---------- ----------------
Microsoft.PowerShell.PSResourceGet 1.0.4.1            {Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository, Get-PSScriptFileInfo…}

Name                      Value
----                      -----
PSVersion                 7.4.2
PSEdition                 Core
GitCommitId               7.4.2
OS                        Microsoft Windows 10.0.19045
Platform                  Win32NT
PSCompatibleVersions      {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion      1.1.0.1
WSManStackVersion         3.0

Visuals

No response