In fact, the simplest way is to set the platform to x86 on the solution.
But today, a third-party software is encountered, it calls a DLL is 32-bit, it may not have been tested in a 64-bit system run situation, it is compiled by default configuration set to any CPU.
However, when running in the default 64-bit mode on a 64-bit system, calling the 32-bit DLL will report an exception ...
So the idea is to let it in the 64-bit system, in 32-bit mode to run just fine ~
Search on the Internet, did not expect. NET itself provides this modification tool, called CorFlags.exe.
MSDN Documentation: https://msdn.microsoft.com/zh-cn/library/ms164699 (v=vs.110). aspx
This tool is typically installed with Visual Studio (actually part of the. NET SDK).
1, so open the "VS Developer Command Prompt" tool in the Start menu:
2. Directly enter CorFlags to use the tool (you can see the relevant Help content):
3, the first is to use corflags assembly file name command, without any parameters, you can use the tool to view information about the. NET Program:
It seems that the main is to see the PE there is PE32, and then 32bit[req] is 0, this seems to represent the current status of any CPU.
4. You can then use corflags assembly file name/32bit+ command, the main is to add the/32bit+ parameter, you can set the program to run in 32-bit mode:
Without any error, it should be success.
5, you can use the 3rd step of the command to check the results of the settings:
Yes, it's changed.
This time to run this program is running in 32-bit mode, and then load 32-bit DLL files will not be wrong ~
Good...
It doesn't seem like much use, does it?
Well, how to make a. NET program in a 64-bit system that runs in 32-bit mode.