views:

959

answers:

4

To complete some testing I need to load the 64 bit version of an assembly even though I am running a 32 bit version of Windows. Is this possible?

A: 

32 bit Windows can not run 64 bit executables without a VM/emutalor

32 bit Windows can compile for execution on 64 bit Windows

pappes
I don't think either MS VPC or VMWare let you run a 64 bit guest on a 32 bit host - not sure about others.
Ryan
A: 

No, you cannot run assemblies that are compiled for 64-bit on a system running the 32-bit version of Windows.

Chris Pietschmann
Why would someone vote this down?? It is impossible to execute a 64-bit assembly on a 32-bit operating system.
Chris Pietschmann
+1  A: 

From CLR Via C# (Jeff Richter):

"If your assembly files contain only type-safe managed code, you are writing code that should work on both 32-bit and 64-bit versions of Windows. No source code changes are required for your code to run on either version of Windows.

In fact, the resulting EXE/DLL file produced by the compiler will run on 32-bit Windows as well as the x64 and IA64 versions of 64-bit Windows! In other words, the one file will run on any machine that has a version of the .NET Framework installed on it."

" The C# compiler offers a /platform command-line switch. This switch allows you to specify whether the resulting assembly can run on x86 machines running 32-bit Windows versions only, x64 machines running 64-bit Windows only, or Intel Itanium machines running 64-bit Windows only. If you don't specify a platform, the default is anycpu, which indicates that the resulting assembly can run on any version of Windows.

Ash
+4  A: 

I'm not sure why you would want to do this, but I suppose you could. If you don't do anything to tell it otherwise, the CLR will load the version of the assembly that is specific to the CPU you are using. That's usually what you want. But I have had an occasion where I needed to load the neutral IL version of an assembly. I used the Load method to specify the version. I haven't tried it (and others here suggest it won't work for an executable assembly), but I suppose you can do the same to specify you want to load the 64 bit version. (You'll have to specify if you want the AMD64 or IA64 version.)

TMarshall