Skip to content

[Bug]: Download-BcNuGetPackageToFolder downloads wrong version for "LatestMatching" and "EarliestMatching" #4060

@OleWunschmann

Description

@OleWunschmann

BCContainerhelper version

6.1.10 & 6.1.11-preview1368

Describe the issue

The function "Download-BcNuGetPackageToFolder" downloads the wrong version for "LatestMatching" and "EarliestMatching", if the trusted nuget feeds contain multiple feeds with the same package and different Versions.

Setup:

  • Feed 1
    • Package A
      • Version 2.0.0.0
  • Feed 2
    • Package A
      • Version 1.0.0.0
  • Feed 3
    • Package A
      • Version 3.0.0.0

Results:

  • LatestMatching
    • Expected: 3.0.0.0
    • Actual: 2.0.0.0
  • EarliestMatching
    • Expected: 1.0.0.0
    • Actual: 2.0.0.0

Command or script used to produce the issue

Download-BcNuGetPackageToFolder -packageName "<package-name>" -select "LatestMatching" -folder "C:\temp\nuget"

Full output of the command or script

Looking for NuGet package <pacakge-name> version 0.0.0.0 (LatestMatching match)
Search NuGetFeed <first-feed>
Search package using ***
Exact match found for <pacakge-name>
- <pacakge-name>
PackageId: <pacakge-name>
13 versions found
First version is 26.1.12
Last version is 26.1.0
Include 26.1.12
Include 26.1.11
Include 26.1.10
Include 26.1.9
Include 26.1.8
Include 26.1.7
Include 26.1.6
Include 26.1.5
Include 26.1.4
Include 26.1.3
Include 26.1.2
Include 26.1.1
Include 26.1.0
Search NuGetFeed <second-feed>
Search package using ***
Exact match found for <pacakge-name>
- <pacakge-name>
PackageId: <pacakge-name>
1 versions found
First version is 26.1.13
Last version is 26.1.13
Include 26.1.13
Best match for package name <pacakge-name> Version 0.0.0.0: <pacakge-name> Version 26.1.12 from <first-feed>
Download nuspec using ***
Download package using ***
Package successfully downloaded
Downloading AL Language Extension to C:\ProgramData\BcContainerHelper\alLanguageExtension\16.2.1869542.zip
using 7zip
Found app file for package <package-name>
Copying <package-name>_26.1.12.0 to C:\temp\nuget

Publisher     Name                                   id                                   Version
---------     ----                                   --                                   -------
***           ***                                    ***                                  26.1.12.0

Additional information

The versions per feed seem to be sorted by "AllDescending" or "AllAscending" but the result of all feeds is not sorted correctly.

Does this happen every time?

Yes

Did this used to work?

Yes

Metadata

Metadata

Assignees

No one assigned

    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