Skip to content

fix(NuGet): prevent duplicate installedApps by keeping the highest version#218

Merged
ps610 merged 4 commits intok8sfrom
psto/fix-duplicate-installedApps
Jan 15, 2026
Merged

fix(NuGet): prevent duplicate installedApps by keeping the highest version#218
ps610 merged 4 commits intok8sfrom
psto/fix-duplicate-installedApps

Conversation

@ps610
Copy link
Member

@ps610 ps610 commented Jan 15, 2026

Duplicate entries in the installedApps cause an error in BCCH when downloading NuGet packages.
fixes AB#4615

...
[INFO] Download Artifact from NuGet package CosmoConsult.COSMOAdvancedManufacturingPack.1b26c6f6-4689-4dc3-af55-f39e95a781f8
...
[INFO] Use app file as installed app: CosmoConsult.COSMOAdvancedManufacturingPack.1b26c6f6-4689-4dc3-af55-f39e95a781f8 (version: 12.2.320329.0)
[INFO] Use app file as installed app: CosmoConsult.COSMOAdvancedManufacturingPack.1b26c6f6-4689-4dc3-af55-f39e95a781f8 (version: 12.2.320329.0)
...
[INFO] Looking for NuGet package CosmoConsult.COSMOAdvancedManufacturingPack.1b26c6f6-4689-4dc3-af55-f39e95a781f8 version 0.0.0.0 (LatestMatching match)
[INFO] Error Message: Cannot convert value "12.2.320329.0 12.2.320329.0" to type "System.Version". Error: "Version string portion was too short or too long."
[INFO] StackTrace: at NormalizeVersionStr, C:\Users\ContainerAdministrator\Documents\WindowsPowerShell\Modules\bccontainerhelper\6.1.10\NuGet\NuGetFeedClass.ps1: line 240
[INFO] at IsVersionIncludedInRange, C:\Users\ContainerAdministrator\Documents\WindowsPowerShell\Modules\bccontainerhelper\6.1.10\NuGet\NuGetFeedClass.ps1: line 273
[INFO] at Download-BcNuGetPackageToFolder, C:\Users\ContainerAdministrator\Documents\WindowsPowerShell\Modules\bccontainerhelper\6.1.10\NuGet\Download-BcNuGetPackageToFolder.ps1: line 132
[INFO] at Invoke-NuGetPackageDownload<Process>, C:\run\ArtifactHandling\NuGet\Invoke-NuGetPackageDownload.ps1: line 156
[INFO] at Invoke-DownloadArtifactCore<Process>, C:\run\ArtifactHandling\Invoke-DownloadArtifactCore.ps1: line 264
[INFO] at Invoke-DownloadArtifact<End>, C:\run\ArtifactHandling\Invoke-DownloadArtifact.ps1: line 100
[INFO] at <ScriptBlock>, C:\Run\my\navstartArtifacts.ps1: line 147
[INFO] at <ScriptBlock>, C:\Run\my\navstartArtifacts.ps1: line 143
[INFO] at <ScriptBlock>, C:\Run\my\navstart.ps1: line 19
[INFO] at <ScriptBlock>, C:\Run\start.ps1: line 391
[INFO] at <ScriptBlock>, <No file>: line 1
...

Copilot AI review requested due to automatic review settings January 15, 2026 07:42
@ps610 ps610 requested a review from a team as a code owner January 15, 2026 07:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes duplicate installedApps entries by implementing version-based deduplication logic, keeping only the highest version when multiple apps with the same ID are found.

Changes:

  • Added deduplication logic in the InstalledAppsPath processing to prevent duplicate app entries with the same ID
  • Implemented version comparison to retain the highest version when duplicates are detected
Comments suppressed due to low confidence (1)

artifacts/ArtifactHandling/NuGet/Invoke-NuGetPackageDownload.ps1:165

  • The predefinedPackages section (lines 116-166) doesn't apply the same duplicate detection logic as the InstalledAppsPath section. If predefined packages can contain duplicates or conflict with each other, they should use the same deduplication approach for consistency.
                $downloadParameters.installedApps += $installedApp

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

artifacts/ArtifactHandling/NuGet/Invoke-NuGetPackageDownload.ps1:166

  • After deduplicating installedApps from the InstalledAppsPath (line 114), the predefinedPackages loop still uses the += operator which can potentially reintroduce duplicates if multiple predefined packages share the same ID. Consider applying the same deduplication pattern here by checking if an app with the same ID already exists before adding, or by collecting all apps in the appsById hashtable and converting to array once at the end.
                $downloadParameters.installedApps += $installedApp

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ps610 ps610 enabled auto-merge (squash) January 15, 2026 07:51
@ps610 ps610 merged commit 99a0d1d into k8s Jan 15, 2026
1 check passed
@ps610 ps610 deleted the psto/fix-duplicate-installedApps branch January 15, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants