Skip to content

Find-PSResource IncludeDependencies incorrectly parses VersionRange #1970

Description

@ernger

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Package is published with nuspec specifying

<dependencies>
  <dependency id="MyPackage" version="1.0.0" />
</dependencies>

Find-PSResource incorrectly sets the maximum version as 1.0.0 too, resulting in Save-PSResource not finding "MyPackage" with version 2.0.0.

This goes against MSFT documentation https://learn.microsoft.com/en-us/nuget/concepts/package-versioning?tabs=semver20sort#version-ranges

Find-Module and Save-Module work correctly.

Tested with Azure and locally hosted https://learn.microsoft.com/en-us/nuget/hosting-packages/nuget-server

(Find-PSResource -Name MyPackage -Repository LocalPSRepo -IncludeDependencies).Dependencies.VersionRange

Expected behavior

IsFloating             : False
MinVersion             : 1.0.0
MaxVersion             :  // Maybe this shouldn't exist at all
HasLowerBound          : True
IsMinInclusive         : True
HasUpperBound          : False
IsMaxInclusive         : False //Not sure on this
HasLowerAndUpperBounds : True
Float                  :
OriginalString         : 1.0.0

Actual behavior

IsFloating             : False
MinVersion             : 1.0.0
MaxVersion             : 1.0.0
HasLowerBound          : True
IsMinInclusive         : True
HasUpperBound          : True
IsMaxInclusive         : True
HasLowerAndUpperBounds : True
Float                  :
OriginalString         : 1.0.0

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.2.0                 Microsoft.PowerShell.PSResourceGet  {Compress-PSRes…


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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions