Force a windows desktop application to run in 32bit process on 64bit OS

Recently, I faced an issue with a downloaded windows application binary/executable. When I double clicked, it throws error popup saying that wrong architecture mismatch. Then my target is to run that age old application to run on my latest x64 bit windows machine in seamless manner.

Some of the suggestions i got from searching net are – changing the application target platform as x86 and re-compile, generate binary. But, am not the creator of that application. Next suggestion is to change the platform to 32-bit environment in IIS settings, if that application runs in IIS context. This option as well not suited me well as my application don’t depend on IIS.

Then, I finally came to know about this particular utility called CorFlags.exe to flip the 32-bit flag on the assembly. I don’t know this is the optimal way of making this works, but for me it solved the issue. This utility mostly comes with default windows OS i guess. But, for me i found in my visual studio installation. To know more about this utility, you can refer this link. I used followed commands to flip 32-bit flag on my application which in turn forces to run as 32-bit process on a 64-bit machine.

To set the 32Bit flag, run following command in command prompt.

CorFlags.exe MyAssembly.exe /32Bit+

To turn off the 32Bit flag,

CorFlags.exe MyAssembly.exe /32Bit-

This solved my problem without much effort. But there is another solution as well – that is to write a wrapper launcher application to your target application. This can be more controlled approach and at the same time, needs to write our own code to launch this application. Anyways, I just wanted to introduce this wonderful utility called CorFlags.exe which resolved my issue in no time.

Leave a Reply

Your email address will not be published. Required fields are marked *