An error appears when running Z3 in C#

前端 未结 2 1859
执笔经年
执笔经年 2021-01-24 07:08

Can anyone please help! When I tried to run the code below, I got this error:

\" Could not load file or assembly \'Microsoft.Z3, Version=4.0.0.0, Cultur

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-24 07:33

    In the comments to the previous answers to this question, reference to the x86 distribution and to the x64 distribution were made, and I am not sure this issue is resolved. To clarify:

    When compiling a 64-bit binary (called x64 in visual studio), then the 64-bit versions of z3.dll and Microsoft.Z3.dll are required. Those are found in the folder called x64 in the Z3 distribution. Note that this does not depend on the actual machine that Visual Studio is running on.

    When compiling a 32-bit binary, then the dlls from the bin directory are required. Again, this does not depend on the actual machine that Visual Studio is running on.

    Visual Studio can cross-compile from 32 to 64 bit and vice versa, i.e., it is possible to compile a binary for the 32-bit architecture (called x86 as opposed to x64) on 64-bit machines. It is also possible to compile 64-bit binaries on a 32-bit machine. Depending on what kind of binary is being compiled, the right set of dlls must be added. The setting that matters is in the build configuration of your project in Visual Studio (on top, usually next to the where debug/release mode is selected). At this compilation stage, it does not matter what type of machine the compilation is being performed on. The actual machine only matters when an attempt is made to run a 64-bit binary on a 32-bit machine (but then the error message will be different from the one reported). Running 32-bit binaries on 64-bit machines usually works fine (but the maximum memory usage of the program will be limited).

    I hope this helped to remove some of the confusion!

    Also, we agree that the combined distribution including both versions creates some unnecessary confusion, so in the future we will consider distributing separate installers for the 32-bit and the 64-bit binaries.

提交回复
热议问题