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 "