Repository navigation
Update Microsoft.Z3 to 5.1.0 for Linux and arm64 native binaries - #61
Merged
HowardvanRooijen merged 3 commits intoOct 28, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the repo to consume Microsoft.Z3 5.1.0 (from GitHub releases rather than nuget.org) and removes the global x64 platform pin so Linux/arm64 environments can resolve the correct native binaries.
Changes:
- Bump central
Microsoft.Z3package version to 5.1.0 and document the GitHub-release/local-feed approach. - Add
scripts/Install-Z3Package.ps1plus a rootNuGet.configthat registers a local folder feed for Z3. - Hook the build to populate the feed before restore, and add repo plumbing (
_z3-feedplaceholder + ignores).
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| solutions/Directory.Packages.props | Bumps Microsoft.Z3 to 5.1.0 and documents local-feed + hash pinning. |
| solutions/Directory.Build.props | Removes PlatformTarget so arm64 machines aren’t forced to x64. |
| scripts/Install-Z3Package.ps1 | New idempotent installer that downloads the Z3 .nupkg from GitHub and verifies SHA-256. |
| NuGet.config | Registers _z3-feed as an additional package source for restore. |
| .zf/config.ps1 | Ensures the Z3 package is installed before restore; temporarily disables publish. |
| .gitignore | Ignores downloaded Z3 .nupkg artifacts in _z3-feed. |
| _z3-feed/.gitkeep | Adds a committed placeholder so the local feed directory exists. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
HowardvanRooijen
force-pushed
the
feature/z3-5.1.0
branch
from
September 1, 2026 13:44
1722b38 to
2cfa263
Compare
Microsoft.Z3 4.12.2 contains native binaries for win-x64 and osx-x64 only. On Linux the managed assembly therefore loads and then fails at the first solve, either with DllNotFoundException or - where the machine happens to have an unrelated system libz3, as the GitHub Actions runner image does - with EntryPointNotFoundException against a solver we never pinned. That is why the build goes red as soon as a stage actually executes a theorem. 5.1.0 ships linux-x64, linux-arm64, osx-x64, osx-arm64, win-x64 and win-arm64. Verified by running the solution on Ubuntu 24.04 (glibc 2.39, matching ubuntu-latest) as well as Windows, and by diffing the full demo output between 4.12.2 and 5.1.0: the Sudoku, oil purchase and warehouse results are identical, and Missionaries & Cannibals still reaches the same optimum under both Optimize() and orderby. Only the unoptimised Solve() picks a different valid model, which is expected where the constraints admit many. The Z3 project stopped publishing to nuget.org after 4.12.2 and now ships the package as a GitHub release asset, so it is fetched into a local folder feed before restore. The download is pinned by SHA-256 and only moved into the feed once it matches, so an interrupted or substituted download cannot become a package that restore consumes. PlatformTarget is dropped now that arm64 binaries exist - pinning x64 would shut those machines out. NOTE: this is not yet safe to publish. The packed Z3.Linq declares a dependency on Microsoft.Z3 5.1.0, which does not exist on nuget.org, so a consumer restoring Z3.Linq from nuget.org fails with NU1102. The published package's dependency has to be settled before this is released. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The packed Z3.Linq declares a dependency on Microsoft.Z3 5.1.0, which is not published to nuget.org, so a consumer restoring from nuget.org with a clean cache fails with NU1102. NuGet gives a package no way to tell consumers where its dependencies live, so no feed we control can fix that - only an upstream publish can. $SkipPublish keeps a tagged build from shipping an unrestorable package in the meantime. Verified: FullBuildAndPublish reports "Publish skipped" and still completes the package stage. See #60 for what lifts the hold, and Z3Prover/z3#10711 upstream. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The README told everyone to target x64, which stops being true with this change: 5.1.0 carries native binaries for x64 and arm64 on all three platforms, so AnyCPU resolves the right one. The note is there because the advice does not apply to anything on nuget.org yet. Published versions depend on Microsoft.Z3 4.12.2, which has no Linux or arm64 binaries, so on those platforms they restore and then throw DllNotFoundException on the first solve - a failure worth naming, since it looks like a bug in this library rather than a missing native. Releases are paused until upstream publishes (#60). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
HowardvanRooijen
force-pushed
the
feature/z3-5.1.0
branch
from
September 1, 2026 14:01
2cfa263 to
10883d8
Compare
MikeEvansLarah
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Microsoft.Z34.12.2 ships native binaries forwin-x64andosx-x64only:On Linux the managed assembly loads and then fails at the first solve. In a clean container
that is
DllNotFoundException; on a machine that happens to carry an unrelated systemlibz3- as the GitHub Actions runner image does - .NET binds to that instead and failswith
EntryPointNotFoundException: Unable to find an entry point named 'Z3_enable_concurrent_dec_ref'.The second is the more dangerous outcome: had the runner carried a closer version, every
entry point would have resolved and the tests would have silently run against a solver we
never pinned. It failed loudly by luck.
This is why CI goes red at #48 - the first PR in the stack whose build actually executes a
theorem. #44, #45 and #47 pass because nothing ever loads the native library.
What
Microsoft.Z35.1.0 (16 Aug 2026) ships six RIDs:win-x64osx-x64linux-x64linux-arm64osx-arm64win-arm64PlatformTarget=x64is dropped as a result - its justifying comment is no longer true, andpinning x64 would shut arm64 machines out.
Getting the package
Z3 stopped publishing to nuget.org after 4.12.2 and has shipped the .NET package as a GitHub
release asset for twenty releases since.
scripts/Install-Z3Package.ps1fetches it into alocal folder feed, wired to the
PreBuildextensibility point so it runs ahead of restore.Because this comes from a release asset rather than a signed nuget.org package, the download
is pinned by SHA-256 and only moved into the feed once it matches - an interrupted or
substituted download never becomes a package restore will consume. The script is idempotent,
so it costs one hash check per build after the first.
$SkipPublish = $true. The packedZ3.Linqdeclares<dependency id="Microsoft.Z3" version="5.1.0" />, and a consumer restoring from nuget.org with a clean cache gets:NuGet gives a package no way to tell consumers where its dependencies live, so no feed we
control can fix this - only an upstream publish can. See #60 for what lifts the hold, and
Z3Prover/z3#10711 upstream, where the blocker is package signing bandwidth rather than
willingness.
Note the published package is already broken on Linux and arm64 for the reason above, so
this is not a new limitation - it is the fix for one, waiting on distribution.
Verification
ubuntu-latest), .NET 10.0.400: buildsclean and the full suite passes. The same container on 4.12.2 fails 36 of 39.
purchase LP ($90,500) and the warehouse LP ($200,000) are identical, and Missionaries &
Cannibals reaches the same optimum under both
Optimize()andorderby. Only unoptimisedSolve()returns a different valid model, which is expected where the constraints admitmany.
Microsoft.Z3membersZ3.Linqcalls are present in 5.1.0, andModel.Evalstill takes itscompletionparameter../build.ps1 FullBuildAndPublish- 35 tasks, 0 errors, 0 warnings, and reportsTask /FullBuildAndPublish/Publish skipped.Stack created with GitHub Stacks CLI • Give Feedback 💬