@@ -27,20 +27,27 @@ $arm64ExtractPath = "win-dml-arm64-unzipped"
2727Write-Host " Extracting $arm64ZipFile to $arm64ExtractPath ..."
2828& $sevenZipPath x $arm64ZipFile - o" $arm64ExtractPath " - y
2929
30+ # Debug: List contents of extracted arm64 zip
31+ Write-Host " Contents of $arm64ExtractPath (recursive):"
32+ Get-ChildItem - Path $arm64ExtractPath - Recurse | ForEach-Object { Write-Host " - $ ( $_.FullName ) " }
33+
3034# 2. Find the target NuGet package.
3135# It finds all .nupkg files that do not contain "Managed" in their name.
3236$nupkgFiles = Get-ChildItem - Path . - Filter * .nupkg | Where-Object { ($_.Name -notlike " *Managed*" ) -and ($_.Name -notlike " *.symbols.nupkg" ) }
3337
38+ Write-Host " Found $ ( $nupkgFiles.Count ) candidate nupkg file(s) for bundling:"
39+ $nupkgFiles | ForEach-Object { Write-Host " - $ ( $_.FullName ) " }
40+
3441# 3. Select the best package (shortest name prefers Release over Dev, and Main over Symbols)
3542if ($nupkgFiles.Count -eq 0 ) {
36- Write-Error " Error: No matching NuGet packages found."
43+ Write-Error " Error: No matching NuGet packages found to bundle into ."
3744 exit 1
3845}
3946if ($nupkgFiles.Count -gt 1 ) {
40- Write-Warning " Found multiple packages. Selecting the one with the shortest filename."
47+ Write-Warning " Found multiple packages. Selecting the one with the shortest filename as the target for bundling ."
4148}
4249$nupkg = $nupkgFiles | Sort-Object {$_.Name.Length } | Select-Object - First 1
43- Write-Host " Selected package: $ ( $nupkg.Name ) "
50+ Write-Host " Selected target package: $ ( $nupkg.Name ) "
4451
4552# 4. Validate the package name matches the expected format.
4653if ($nupkg.Name -notlike " Microsoft.ML.OnnxRuntime.DirectML*.nupkg" ) {
@@ -64,14 +71,27 @@ New-Item -ItemType Directory -Path $tempDir | Out-Null
6471Write-Host " Extracting $ ( $nupkg.Name ) to $tempDir ..."
6572& $sevenZipPath x $nupkg.FullName - o" $tempDir " - y
6673
74+ # Debug: List contents of extracted target nupkg
75+ Write-Host " Contents of $tempDir (recursive):"
76+ Get-ChildItem - Path $tempDir - Recurse | ForEach-Object { Write-Host " - $ ( $_.FullName ) " }
77+
6778# Step B: Create the new runtime directory structure.
6879$newRuntimePath = Join-Path $tempDir " runtimes\win-arm64\native"
80+ Write-Host " Ensuring destination path exists: $newRuntimePath "
6981New-Item - ItemType Directory - Path $newRuntimePath - Force | Out-Null
7082
7183# Step C: Copy the ARM64 binaries into the new structure.
7284$arm64SourcePath = Join-Path . " $arm64ExtractPath \runtimes\win-arm64\native"
73- Write-Host " Copying ARM64 binaries from $arm64SourcePath to $newRuntimePath ..."
74- Copy-Item - Path " $arm64SourcePath \*" - Destination $newRuntimePath - Recurse - Force
85+ if (Test-Path $arm64SourcePath ) {
86+ Write-Host " Copying ARM64 binaries from $arm64SourcePath to $newRuntimePath ..."
87+ $filesToCopy = Get-ChildItem - Path " $arm64SourcePath \*"
88+ Write-Host " Files found in source: $ ( $filesToCopy.Count ) "
89+ $filesToCopy | ForEach-Object { Write-Host " -> $ ( $_.Name ) " }
90+ Copy-Item - Path " $arm64SourcePath \*" - Destination $newRuntimePath - Recurse - Force
91+ } else {
92+ Write-Error " Error: ARM64 source path not found: $arm64SourcePath . Bailing out to avoid creating a broken package."
93+ exit 1
94+ }
7595
7696# Step D: Delete the original nupkg file.
7797Remove-Item - Path $nupkg.FullName - Force
@@ -82,6 +102,13 @@ Push-Location $tempDir
82102& $sevenZipPath a - tzip " $ ( $nupkg.FullName ) " " .\" - r
83103Pop-Location
84104
105+ # Debug: Check final nupkg existence
106+ if (Test-Path $nupkg.FullName ) {
107+ Write-Host " Final package created successfully: $ ( $nupkg.FullName ) "
108+ $finalSize = (Get-Item $nupkg.FullName ).Length
109+ Write-Host " Final package size: $finalSize bytes"
110+ }
111+
85112# --- Cleanup and Final Steps ---
86113Write-Host " Cleaning up temporary directory $tempDir ..."
87114Remove-Item - Recurse - Force $tempDir
0 commit comments