Skip to content

Leave mobile ONNX runtimes out of the tool package - #114

Merged
paulirwin merged 1 commit into
mainfrom
trim-tool-package
Oct 27, 2026
Merged

paulirwin merged 1 commit into
mainfrom
trim-tool-package

Conversation

@paulirwin

Copy link
Copy Markdown
Member

The AzureSearchEmulator tool package grew from 4.8 MB at 1.0.0-beta.4 to 168 MB (270 MB unpacked) at 1.0.0-rc.1. nuget.org accepted the rc.1 upload, but it was still not listed long after the Aspire package from the same push was.

Why it grew

The semantic reranker (#110) added Microsoft.ML.OnnxRuntime. That package ships native binaries for every platform it supports, and a framework-dependent publish, which is what a tool packs, copies all of them. The largest two are mobile ones the emulator can never run on:

File Size
runtimes/ios/native/onnxruntime.xcframework.zip 59 MB
runtimes/android/native/onnxruntime.aar 55 MB

The change

A target in AzureSearchEmulator.csproj removes runtimes/ios/ and runtimes/android/ from the publish output after it is computed. The package is now 55 MB.

The desktop and server runtimes (linux-x64, linux-arm64, osx-arm64, win-x64, win-arm64) all stay, so the tool still runs everywhere it did. The Docker image is built by dotnet publish as well, so it loses the same unused files.

Verified

  • dotnet pack output contains no runtimes/ios or runtimes/android entries.
  • Installed the packed tool from a local source on macOS (arm64) and started it with Emulator__SemanticRanker__Enabled=true. The model downloaded and loaded, and a semantic query returned a cross-encoder @search.rerankerScore (3.99). This shows ONNX Runtime still loads from the trimmed package.

This only takes effect in the next release, either an rc.2 or folded into the next version.

🤖 Generated with Claude Code

The tool package grew from 4.8 MB at 1.0.0-beta.4 to 168 MB at
1.0.0-rc.1. ONNX Runtime, added for the semantic reranker (#110), ships
native binaries for iOS and Android next to the desktop and server ones,
and a framework-dependent publish copies them all. Those two files alone
were 114 MB, and the emulator can't run on either platform.

Remove runtimes/ios and runtimes/android from the publish output, which
is what `dotnet pack` packs for a tool. The package is now 55 MB. The
container image loses the same files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paulirwin
paulirwin merged commit ba1a3d0 into main Oct 27, 2026
5 checks passed
@paulirwin
paulirwin deleted the trim-tool-package branch October 27, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant