Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a difference between a 32-bit .NET application and a 64-bit .NET application?

Tags:

My understanding is that a .NET application is platform independent, so pure .NET code should run either on a x86 or on a 64-bit machine. Unless your .NET code call some native code, then it is platform dependent. Is that true?

like image 645
Jack Lee Avatar asked Feb 07 '12 13:02

Jack Lee


People also ask

What is difference between 32-bit and 64-bit applications?

As its name suggests, the 32 bit OS can store and handle lesser data than the 64 bit OS. More specifically, it addresses a maximum of 4,294,967,296 bytes (4 GB) of RAM. The 64 bit OS, on the other hand, can handle more data than the 32 bit OS.

How do you tell if .NET application is 32 or 64-bit?

Run the application and launch the Task Manager to know if the process runs in 32-bit mode or 64-bit mode on a 64-bit machine. When "*32" is added to the 'image name', the process is running in 32-bit mode. Otherwise it is running in 64-bit mode.

Can a 32 bit application launch a 64-bit application?

The 64-bit versions of Windows don't provide support for 16-bit binaries or 32-bit drivers. Programs that depend on 16-bit binaries or 32-bit drivers can't run on the 64-bit versions of Windows unless the program manufacturer provides an update for the program.


2 Answers

.NET applications can be compiled as targeting x86, x64, or "Both". Typically, you'd target just one platform if you rely on a COM control that is not available for the other platform, etc.

like image 68
Rowland Shaw Avatar answered Nov 05 '22 16:11

Rowland Shaw


Your code can be compiled to be fully platform independent, or you can target a specific platform. The standard recommendation is to leave libraries architecture-neutral (that is, "Any CPU") and target x86 for executables. The reasons why Visual Studio 2010 uses this approach by default are explained here: AnyCPU executables are usually more trouble than they're worth:

  1. Running in two very different modes (x64 and x86) increases product complexity and the cost of testing.
  2. 32-bit tends to be (a little) faster anyway.
  3. Some features aren't available in x64.
  4. If more than 4 GB address space would be useful, the right thing to do is to target just x64 and avoid the cost of supporting two platforms.

Of course, if you just target x86 then your code would still run on x64 through WoW64.

like image 23
Ade Stringer Avatar answered Nov 05 '22 14:11

Ade Stringer