tags:

views:

136

answers:

5

How will my .NET application run under Windows 2008 x64? As a 32 bit application or as a 64 bit? Does that make any difference?

+2  A: 

If you compile it with the "run on any machine option" it will run as a 64 bit application.

If force it to compile as "run as 32 bit" then it will run as a 32 bit app on an x64 machine.

Kevin
+5  A: 

It'll run 64 bit if it's targeting 64bit architecture, or is set to run on Any platform.

It'll run 32 bit if it's targetted for 32bit architecture. If you need to use native DLLs, you'll want to make sure it's targetted correctly.

This will work the same as 64bit Vista.

Reed Copsey
A: 

Depends on how you built it, and how you should have built it. :-) If you didn't specify a specific model then your app will run as a 32-bit on x86 and a 64-bit on x64. This is generally what you want. The exceptions to this start popping up when you're interoperating with 32-bit code on the 64-bit system. For example, if you're calling out to a DLL that expects an 'int' to be 32-bits and you pass it 64 bits then things go very wrong very fast.

WaldenL
A: 

.net code copiled to target 'any' platform (check out the projects build configuration) will be compiled from IL into 64bit machine code instructions. if you specify 32bit then it will be compiled into 32bit and then converted as if it was 32bit machine code running on a 64bit OS!

There are some compatability issues with some libraries when compiled into 64bit code.

Edit: XNA is an example of where you would want to target 32 specifcally, check out this: http://www.brianpeek.com/blog/archive/2007/11/13/x64-development-with-net.aspx

Note: Int is int regardless of what platform it's running on? aint it?

Dog Ears
yes int is an int no matter if your 32 or 64bit from Dot Net's perspective BUT memory pointers IntPtr "The IntPtr type is designed to be an integer whose size is platform-specific. ... is expected to be 32-bits on 32-bit hardware and operating systems, and 64-bits on 64-bit."
Bryan Bailliache
I see..! but as i see it, you can't load a 32bit dll into a 64bit processs so is that, in fact, incidental?
Dog Ears
A: 

After my question here and the answer to it, I'll think twice about allowing an application to run as 64-bit. It seems the 64-bit JIT is really limited compared to the more mature 32-bit JIT.

JulianR