tags:

views:

741

answers:

5

I have an executable that defaults to 32-bit. It doesn't have source code and I want to keep both 32-bit and 64-bit frameworks on the system. Is there a way to make that executable run on 64-bit .NET framework instead?

A: 

Do you have the source code or just the Exe?

If you have the source code you could just compile it to 64 bit, if you dont you could use reflector do get the source code and recompile it to 64 bit.

Petoj
+2  A: 

use the corflags tool to flip the '64 bit is okay if available' flag

This blog post explains this with examples and some further links.

If you have the source code recompiling with anything VS 2005 and over will allow you to change the settings to make it willing to run as 64 bit.

ShuggyCoUk
+1  A: 

If you application needs to run on both 32-bit and 64-bit systems, a good way is to configure the compiler to force the binary running in 32-bit mode. This will force any 64-bit system to run your application in a 32-bit emulation mode. (Project properties -> Build -> Target Platform -> "x86" instead of "Any CPU")

Otherwise you have to provide two binary versions of your application: a 32-bit binary and a 64-bit binary.

Alexander
+1  A: 

If the executable is written in .NET and is all managed code there should be no problem running it under 64bit. The .Net-Framework for x64 comes with CLRs for both 32bit and 64bit code.

Consider reading this blogpost by Scott Hanselman, it covers the issue:

Back to Basics: 32-bit and 64-bit confusion around x86 and x64 and the .NET Framework and CLR

lowglider
A: 

Scott Hanselman recently blogged about this.

Writing managed code is a pretty good way to not have to worry about any x86 (32-bit) vs. x64 (64-bit) details. Write managed code, compile, and it'll work everywhere.

So in effect, if you build it for "Any CPU", it should run in 64-bit mode on a 64-bit OS automatically. But you can only do that if all the code is managed. You should read the blog entry for details.

Dave Van den Eynde
I guess it was compiled against x86 only.
ssg