diff --git a/.pipelines/UpdateVersions.ps1 b/.pipelines/UpdateVersions.ps1
index 0be3e3d30b..e7e3c28737 100644
--- a/.pipelines/UpdateVersions.ps1
+++ b/.pipelines/UpdateVersions.ps1
@@ -112,16 +112,37 @@ if ($latestVersion) {
exit 1
}
-# Update packages.config files
-Get-ChildItem -Path $rootPath -Recurse packages.config | ForEach-Object {
- $file = Read-FileWithEncoding -Path $_.FullName
- $content = $file.Content
- if ($content -match 'package id="Microsoft.WindowsAppSDK"') {
- $newVersionString = 'package id="Microsoft.WindowsAppSDK" version="' + $WinAppSDKVersion + '"'
- $oldVersionString = 'package id="Microsoft.WindowsAppSDK" version="[-.0-9a-zA-Z]*"'
- $content = $content -replace $oldVersionString, $newVersionString
- Write-FileWithEncoding -Path $_.FullName -Content $content -Encoding $file.encoding
- Write-Host "Modified " $_.FullName
+# Resolve dependencies for 1.8+
+$packageVersions = @{ "Microsoft.WindowsAppSDK" = $WinAppSDKVersion }
+
+if ($WinAppSDKVersion -match "^1\.8") {
+ Write-Host "Version $WinAppSDKVersion detected. Resolving split dependencies..."
+ $tempDir = Join-Path $env:TEMP "winappsdk_deps_$(Get-Random)"
+ New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
+ try {
+ # Create a temporary nuget.config to avoid interference from the repo's config
+ $tempConfig = Join-Path $tempDir "nuget.config"
+ Set-Content -Path $tempConfig -Value ""
+
+ # Download package to inspect nuspec
+ $nugetArgs = "install Microsoft.WindowsAppSDK -Version $WinAppSDKVersion -ConfigFile $tempConfig -OutputDirectory $tempDir -NonInteractive -NoCache"
+ Invoke-Expression "nuget $nugetArgs" | Out-Null
+
+ # Parse dependencies from the installed folders
+ # Folder structure is typically {PackageId}.{Version}
+ $directories = Get-ChildItem -Path $tempDir -Directory
+ foreach ($dir in $directories) {
+ if ($dir.Name -match "^(Microsoft\.WindowsAppSDK.*?)\.(\d.*)$") {
+ $pkgId = $Matches[1]
+ $pkgVer = $Matches[2]
+ $packageVersions[$pkgId] = $pkgVer
+ Write-Host "Found dependency: $pkgId = $pkgVer"
+ }
+ }
+ } catch {
+ Write-Warning "Failed to resolve dependencies: $_"
+ } finally {
+ Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
@@ -129,39 +150,30 @@ Get-ChildItem -Path $rootPath -Recurse packages.config | ForEach-Object {
Get-ChildItem -Path $rootPath -Recurse "Directory.Packages.props" | ForEach-Object {
$file = Read-FileWithEncoding -Path $_.FullName
$content = $file.Content
- if ($content -match ''
- $oldVersionString = ''
- $content = $content -replace $oldVersionString, $newVersionString
+ $isModified = $false
+
+ foreach ($pkgId in $packageVersions.Keys) {
+ $ver = $packageVersions[$pkgId]
+ # Escape dots in package ID for regex
+ $pkgIdRegex = $pkgId -replace '\.', '\.'
+
+ $newVersionString = ""
+ $oldVersionString = ""
+
+ if ($content -match "