问题
We are using a Third-Party assembly that seems to be compiled as AnyCPU.
However, we have a number of installations of our application where this leads to problems. This Third-Party assembly makes use of the oracle dataaccess library, and will not work on 64-bit machines where only a 32-bit oracle client is installed.
Installing a additional 64-bit oracle client would be possible, but also expensive (takes a lot of time, many machines have to be updated etc.)
Is there a way to force a AnyCPU .Net assembly to run as 32-bit without recompiling?
回答1:
Have a look at CorFlags.exe.
Example (set 32BIT flag):
corflags [path]\[YourAssembly.exe] /32Bit+
回答2:
Assuming that you are building the .EXE that has a reference to a AnyCPU third party assembly you need to build your project as x86. This project can reference AnyCPU assemblies but being marked as x86 it will run as a 32 bit process on both 32 bit and 64 bit Windows.
来源:https://stackoverflow.com/questions/10945664/run-anycpu-as-32-bit-on-64-bit-systems