|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Updated: December 2010
When you compile an application, you can specify that it should run on a Windows 64-bit operating system either as a native application or under WOW64. WOW64 is a compatibility environment that enables a 32-bit application to run on a 64-bit system. WOW64 is included in the system.
All applications that are built on the .NET Framework versions 1.0 or 1.1 are treated as 32-bit applications and are always executed under WOW64 on the 32-bit common language runtime (CLR) on a 64-bit operating system. In addition, 32-bit-specific applications that are built on the .NET Framework version 3.5 would run under WOW64 on 64-bit systems.
Visual Studio installs the 32-bit version of the CLR on an x86 computer, and both the 32-bit version and the appropriate 64-bit version of the CLR on a 64-bit Windows computer. (Because Visual Studio 2008 is a 32-bit application, when it is installed on a 64-bit system, it runs under WOW64.)
Because of the design of x86 emulation and the WOW64 subsystem for the Itanium processor family, applications are restricted to execution on one processor. These factors reduce the performance and scalability of 32-bit .NET Framework applications that run on Itanium-based systems. We recommend that applications that use the .NET Framework 1.1 be used for interactive, client applications and not for applications that demand high performance or scalability, for example, high-load ASP.NET applications. If you can, use the , which includes native 64-bit support for Itanium-based systems, for increased performance and scalability.
When you run a 64-bit managed application on a 64-bit Windows operating system, you can create an object of no more than 2 gigabytes (GB).
Many assemblies run identically on both the 32-bit CLR and the 64-bit CLR. However, some programs may behave differently, depending on the CLR, for one or more of the following reasons:
Structs that contain members that change size depending on the platform, such as any pointer type.
Pointer arithmetic that includes constant sizes.
Incorrect platform invoke or COM declarations that use Int32 for handles instead of IntPtr.
Casting IntPtr to Int32.
For more information about how to port a 32-bit application to run on the 64-bit CLR, see Migrating 32-bit Managed Code to 64-bit on the MSDN website.
For general information about 64-bit programming, see the following documents:
For more information about the 64-bit version of the CLR on a 64-bit Windows computer, see .NET Framework Developer Center on the MSDN website.
In the Windows SDK documentation, see Programming Guide for 64-bit Windows.
For information about how to download a 64-bit version of the CLR, see .NET Framework Developer Center Downloads on the MSDN website.
For information about support in the Visual Studio development environment for creating 64-bit applications, see Visual Studio Development Environment 64-Bit Support.
By default, when you use the .NET Framework 2.0 to build an application on either a 32-bit or a 64-bit computer, the application will run on a 64-bit computer as a native application (that is, not under WOW64). The following table lists documents that teach how to use Visual Studio compilers to create 64-bit applications that will run as native, under WOW64, or both.
You can create platform-agnostic, Microsoft intermediate language (MSIL) applications by using /clr:safe. For more information, see /clr (Common Language Runtime Compilation).
Visual C++ includes a separate compiler for each 64-bit operating system. For more information about how to use Visual C++ to create native applications that run on a 64-bit Windows operating system, see 64-Bit Programming with Visual C++.
To determine whether an .exe file or .dll file is meant to run only on a specific platform or under WOW64, use corflags.exe at the command prompt. You can also use corflags.exe to change the platform status of an .exe file or .dll file. For more information, see CorFlags Conversion Tool (CorFlags.exe). The CLR header (or COM+ Runtime header) of a Visual Studio assembly has the major runtime version number set to 2 and the minor runtime version number set to 5 (0 in Visual Studio .NET 2003 assemblies). Applications that have the minor runtime version set to 0 are treated as legacy applications and are always executed under WOW64.
To programmatically query an .exe or .dll to see whether it is meant to run only on a specific platform or under WOW64, use the GetPEKind method.