3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-06-19 07:06:28 +00:00

Fix .NET wrapper PE Machine field: add PlatformTarget AnyCPU to prevent x64-only DLL

The managed Microsoft.Z3.dll was being built with Machine=0x8664 (AMD64)
because the Windows x64 CI environment (vcvarsall.bat x64) sets the MSBuild
Platform=x64 environment variable, which causes dotnet build to emit an x64
PE header even though the assembly is pure IL (ILONLY=True).

Fix: explicitly set <PlatformTarget>AnyCPU</PlatformTarget> in both build paths:
- scripts/mk_util.py: csproj template used by Python build system
  (mk_win_dist.py, mk_unix_dist.py)
- src/api/dotnet/Microsoft.Z3.csproj.in: csproj template used by CMake build

This produces Machine=0x014C (i386/AnyCPU) so arm64 .NET hosts on macOS,
Linux and Windows can load the wrapper without error FS0193.

Closes #9863
This commit is contained in:
copilot-swe-agent[bot] 2026-06-15 14:35:23 +00:00 committed by GitHub
parent e90100ae57
commit 178879e184
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View file

@ -1804,6 +1804,7 @@ class DotNetDLLComponent(Component):
<Description>Z3 is a satisfiability modulo theories solver from Microsoft Research.</Description>
<Copyright>Copyright Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>smt constraint solver theorem prover</PackageTags>
<PlatformTarget>AnyCPU</PlatformTarget>
%s
</PropertyGroup>

View file

@ -60,6 +60,7 @@
<Warn>4</Warn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>$(OutputPath)\Microsoft.Z3.xml</DocumentationFile>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<!-- Compilation items -->