File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
tools/ci_build/github/windows Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -31,15 +31,16 @@ Write-Host "Extracting $arm64ZipFile to $arm64ExtractPath..."
3131# It finds all .nupkg files that do not contain "Managed" in their name.
3232$nupkgFiles = Get-ChildItem - Path . - Filter * .nupkg | Where-Object { ($_.Name -notlike " *Managed*" ) -and ($_.Name -notlike " *.symbols.nupkg" ) }
3333
34- # 3. Validate that exactly one package was found.
35- Write-Host " Found $ ( $nupkgFiles.Count ) non-managed nupkg file(s):"
36- $nupkgFiles | ForEach-Object { Write-Host " - $ ( $_.FullName ) " }
37- if ($nupkgFiles.Count -ne 1 ) {
38- Write-Error " Error: Expected to find exactly one non-managed NuGet package, but found $ ( $nupkgFiles.Count ) ."
34+ # 3. Select the best package (shortest name prefers Release over Dev, and Main over Symbols)
35+ if ($nupkgFiles.Count -eq 0 ) {
36+ Write-Error " Error: No matching NuGet packages found."
3937 exit 1
4038}
41- $nupkg = $nupkgFiles [0 ]
42- Write-Host " Found package to process: $ ( $nupkg.Name ) "
39+ if ($nupkgFiles.Count -gt 1 ) {
40+ Write-Warning " Found multiple packages. Selecting the one with the shortest filename."
41+ }
42+ $nupkg = $nupkgFiles | Sort-Object {$_.Name.Length } | Select-Object - First 1
43+ Write-Host " Selected package: $ ( $nupkg.Name ) "
4344
4445# 4. Validate the package name matches the expected format.
4546if ($nupkg.Name -notlike " Microsoft.ML.OnnxRuntime.DirectML*.nupkg" ) {
You can’t perform that action at this time.
0 commit comments