Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Microsoft.NET\Framework and Microsoft.NET\Framework64?

I would like to know the difference between .NET modes x86 and x64.

  1. What is the difference for both modes?

  2. Can I compile my libraries for example with .NET x64 and .NET x86?

  3. Would it be any difference for me if I choose x64 instead of x86?

  4. What is the advantage of .NET x64?

  5. Do I have to install anything special if I want to use .NET x64?

like image 723
truthseeker Avatar asked Dec 28 '10 10:12

truthseeker


1 Answers

Complex question, I'll try to simplify:

  1. Any .Net application can be compiled for both x86 (32-bit) and x64 (64-bit) at once. Actually they do by default. You can change this by changing target CPU in Build-tab in project Properties. Supported targets are "Any" (will Just-In-Time compile to 32 or 64-bit depending on operative system support), "x86" will compile to 32-bit which works on all platforms, and "x64" will compile to 64-bit which only works on 64-bit platforms.

  2. Yes. See above. Also note that there is a second level of compile sometimes performed, and that is the NGEN. It creates a native image for a specific CPU type. However, if you mess with this you know already.

  3. For .dll's choose "Any" CPU for them. For .EXE (entry point) you must choose Any, x86 or x64. There are some things to consider: x86 .Net apps accessing native Windows .dll-files (interpo) require x86 .dll-files. So a 64-bit app can't access 32-bit API-calls and vice versa. This is often a reason for .Net apps to fail on 64-bit operating systems. The way to solve this is to either reference correct .dll's or simply set the .Net application to x86 (32-bit) under properties. All other dependencies will automatically become 32-bit during Just-In-Time compile if they are set to "Any".

  4. The advantages of 64-bit are complex. There are advantages and drawbacks depending on what your app does. The most obvious advantage is that your application can break the 2GB memory barrier. The disadvantage is as explained in #3, if you reference 64-bit .dll's your app won't execute on 32-bit operating systems.

  5. Everything comes out-of-the-box. Don't worry about a thing, except all the stuff above. :)

like image 117
Tedd Hansen Avatar answered Nov 02 '22 17:11

Tedd Hansen