With 64 bit versions of Windows fast becoming the standard it is imperative that an app work in both 32 bit and 64 bit environments. This done using a basic configuration setting, with a few caveats of course. In Visual Studio in the project’s build options you can select the app’s Platform target, which can be x86, x64, Itanium, or Any CPU (the listing you see may vary, depending on what you have installed with Visual Studio).
Since .NET assemblies consist of byte code that is JIT (just-in-time) compiled to the current platform at runtime, an app’s assemblies will function on any architecture without needing to rebuild from the source code.
However, the choice is not always that simple. If your .NET assembly references or interops with another managed assembly or an unmanaged DLL which was compiled for a certain architecture, then your app’s .NET assembly will need to match the assembly or dll’s.
Take for example a scenario where you have the following:
- .NET assembly: Any CPU
- 32-bit COM component
Note that x64 OSs run 32-bit processes just fine. Also bear in mind that while .NET itself mostly insulates you from platform architecture considerations, when you using unsafe code, pointers, or relying on the size of IntPtr, you will likely encounter issues when running on multiple architectures.
compile by Divyang Panchasara Sr. Programmer Analyst Hitech OutSourcing
No comments:
Post a Comment