diff --git a/.github/workflows/nightly-validation.yml b/.github/workflows/nightly-validation.yml
index 73c79704b..374f522ba 100644
--- a/.github/workflows/nightly-validation.yml
+++ b/.github/workflows/nightly-validation.yml
@@ -165,10 +165,23 @@ jobs:
cd test-nuget
dotnet new console
dotnet add package Microsoft.Z3 --source ../nuget-packages --prerelease
- # Add RuntimeIdentifier to ensure native library is loaded correctly
- sed -i '' '/<\/PropertyGroup>/i\
- osx-x64\
- ' test-nuget.csproj
+ # Configure project to properly load native dependencies on macOS x64
+ # Use AnyCPU without RuntimeIdentifier to avoid architecture mismatch
+ # The .NET runtime will automatically select the correct native library from runtimes/osx-x64/native/
+ cat > test-nuget.csproj << 'CSPROJ'
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ AnyCPU
+
+
+
+
+
+ CSPROJ
- name: Create test code
run: |
@@ -224,10 +237,23 @@ jobs:
cd test-nuget
dotnet new console
dotnet add package Microsoft.Z3 --source ../nuget-packages --prerelease
- # Add RuntimeIdentifier to ensure native library is loaded correctly
- sed -i '' '/<\/PropertyGroup>/i\
- osx-arm64\
- ' test-nuget.csproj
+ # Configure project to properly load native dependencies on macOS ARM64
+ # Use AnyCPU without RuntimeIdentifier to avoid architecture mismatch
+ # The .NET runtime will automatically select the correct native library from runtimes/osx-arm64/native/
+ cat > test-nuget.csproj << 'CSPROJ'
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ AnyCPU
+
+
+
+
+
+ CSPROJ
- name: Create test code
run: |