I have a .Net application, compiled with the "Any" flag set for the architecture type.

I am wondering if it is possible to force the application to run as a 32 bit application, on a(any) 64 bit version of windows, without recompiling the application into a 32 bit executable.

  • Out of curiosity, why would you want to? – Ryan Bolger Sep 24 '09 at 20:47
  • Some drivers are only available in 32 bit versions - and if the app runs as a 64 bit app, it likely won't be able to see them or use them. Since this particular app can run safely as either 32 or 64 bits, I'm trying to figure out if I can force it to run as a 32 bit app and access a better list of drivers. – blueberryfields Sep 24 '09 at 21:08
  • Can this be migrated to stackOverflow? – setatakahashi Sep 24 '09 at 23:37
  • Good idea; voted to migrate – Maximus Minimus Sep 25 '09 at 8:51

Yes, if you set the project properties to use 32-bit (x86 I think) explicitly it will always run in that mode. We had that issue when using the SQLite ADO.Net provider (it was looking for the 32-bit version only, which couldn't load when run on a x64 system).

You can use corflags to set the 32-bit bit (ha ha) flag on the executable. Here is an example. In short, you'll run:

corflags /32BIT+ assembly.exe-or.dll

You'll find corflags.exe installed with the SDK with Visual Studio (installed in C:\Program Files\Microsoft SDK\6.0a or 7.0\bin) or you can get it from the the Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.