This is a mirror of official site: http://jasper-net.blogspot.com/

/Platform:AnyCPU, /Platform:x64, /Platform:x86, what do they mean

| Monday, April 18, 2011
When we build a .net solution, we often see the Platform choice in the configuration manager:

image_1B2789E4.png

Besides AnyCPU, other choices are x86 ,x64, and Itanium. What do they mean? According to MSDN, “Anycpu” compiles the assembly to run on any platform while the other 3 choices compiles the assembly for 32 bit, 64 bit x64 and 64bit Itanium respectively.

On a 64-bit Windows operating system:

Assemblies compiled with /platform:x86 will execute on the 32 bit CLR running under WOW64.

Executables compiled with the /platform:anycpu will execute on the 64 bit CLR.

DLLs compiled with the /platform:anycpu will execute on the same CLR as the process into which it is being loaded.

If a .net application uses any 32 bit ActiveX component, it will not be able to load the component in-process. We have two choices:

Host the 32 bit component in an external process, such as COM+ Server Application, or Run the .NET application as a 32 bit application.
The VBScriptTest project in ASP Classic Compiler contains an unmanaged test. It hosts the msscript.ocx so that I can compare my .net implementation of VBScript against the original VBScript engine from Microsoft. In order to use the 32 bit msscript.ocx, I need to run my unit test in a 32 bit process. NUnit has a 32 bit version of the test runner call NUnit-x86.exe. To use the 32 bit runner, I registered new shell extension as shown below so that I can use the “Run 32 bit NUnit” context menu to invoke the 32 bit NUnit test:

image_3991CACD.png

Lastly, how to run ASP.NET in 32 bit? It turned out that this is controlled by the Application Pool. If I set the “Enabled 32 bit Application” to true in the Advance Property Setting of the application pool, the ASP.NET application will run in 32 bit.

Read more: Li Chen's Blog

Posted via email from Jasper-net

0 comments: