Run applications in Windows 7 as 32 bit

64-bitvisual studio 2010windows 7x86

So we have an app that used to compile to "Any CPU". It would run in 64 bit mode on Windows 7 machines, but would error out when it tried to make a call to an interop running in 32 bit mode.

I went through and changed the compile targets to target x86 for the project, compiled and ran it locally, and it worked fine.

However, when this change was committed, it still runs as 64 bit in Windows 7 machines in production.

When I made the change, I just opened the Configuration Manager in VS2010, changed it to x86, saved it, and committed the change for each project in the solution.

How can I get it to run in 32 bit mode? Do I need to change something else?

Best Answer

You want the corflags tool in the SDK

corflags MyApp.exe /32bit+

will change the exe to run as a 32bit process.

Conversely

corflags MyApp.exe /32bit-

Will change the exe to be AnyCPU

corflags MyApp.exe

Will tell you what's in the header for the exe, so you can actually see what it's going to target.