From 80e237615ed168eace715d6057c8ee5f96e5de26 Mon Sep 17 00:00:00 2001 From: Shawn Yuan Date: Thu, 12 Feb 2026 15:30:14 +0800 Subject: [PATCH] update --- .pipelines/UpdateVersions.ps1 | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.pipelines/UpdateVersions.ps1 b/.pipelines/UpdateVersions.ps1 index b5714010da..90aabb3f51 100644 --- a/.pipelines/UpdateVersions.ps1 +++ b/.pipelines/UpdateVersions.ps1 @@ -344,12 +344,22 @@ function Resolve-ArtifactBasedDependencies { # Parse all downloaded packages to get actual versions $directories = Get-ChildItem -Path $OutputDir -Directory $allLocalPackages = @() + + # Add metapackage and runtime to the list (they are .nupkg files, not directories) + $allLocalPackages += $MetaPackageName + if ($packageVersions.ContainsKey("$MetaPackageName.Runtime")) { + $allLocalPackages += "$MetaPackageName.Runtime" + } + foreach ($dir in $directories) { if ($dir.Name -match "^(.+?)\.(\d+\..*)$") { $pkgId = $Matches[1] $pkgVer = $Matches[2] $allLocalPackages += $pkgId - $packageVersions[$pkgId] = $pkgVer + # Don't overwrite metapackage version that was set earlier + if (-not $packageVersions.ContainsKey($pkgId)) { + $packageVersions[$pkgId] = $pkgVer + } } } @@ -530,9 +540,13 @@ Get-ChildItem -Path $rootPath -Recurse "Directory.Packages.props" | ForEach-Obje $ver = $packageVersions[$pkgId] # Escape dots in package ID for regex $pkgIdRegex = $pkgId -replace '\.', '\.' - - $newVersionString = "" - $oldVersionString = "" + + # Use explicit version bounds [version] to avoid NU1602/NU1604 errors + # Square brackets specify an exact version with inclusive lower bound + $newVersionString = "" + + # Match both old format (without brackets) and new format (with brackets) + $oldVersionString = "" if ($content -match "