The 32-bit DLLs run on the both 32-bit as well as 64-bit operating system or environment. But only the 32-bit mode application can load the 32-bit mode DLLs. By default a .NET application is configured to run on any CPU—the application (an executable file) can run on both 32-bit and 64-bit operating systems.
First, consider the scenario with 32-bit operating system, 32-bit dependent DLLs, and a 32-bit application. In this scenario, the 32-bit application can load 32-bit DLLs, so the application will run as desired. However, there’s another scenario; when a user tries to run the same 32-bit application on a 64-bit operating system, the application will run in 64-bit (any CPU) mode and will fail to load the 32-bit DLLs. The solution to this problem is very simple. Force the application to run in 32-bit mode by following this procedure in Visual Studio to set the compile options:
- Open the project properties page.
- Go to the “Compile” tab and click on the “Advanced Compile Options” button.
- Set the “Target CPU” item to “x86”
This procedure enables the application to run in 32-bit mode, so it will successfully load the 32-bit mode DLLs on 64-bit machines, and the application will run successfully on both 32-bit and 64-bit machines.