Currently I am creating an MSI for installing my .net-written (C#) software on a x64-System. This is necessary because I generate some registry-entries and I don’t want to decide programmatically to which registry-path I have to point (avoiding WOW6432-node).
During this I ask myself, if it is necessary to compile my software explicitly for x64-systems (Run-Configuration “x64”). Currently I always compile my software in Visual Studio platform agnostic with “Any CPU”. In my source code I do not differentiate between x64 and x86.
The CIL-code is compiled by the JIT-compiler, so I think it will explicitly compile it to 64bit on runtime, or am I wrong?
What are the differences between the explicit “x64”-compiling and the platform agnostic compiling in visual studio?
How influences the x64-flag the compilation?
If your program (With Any CPU) is launched on a 64-bit platform it will start in 64-bit mode. This will often work very well – the exception is if you program relies on native libraries for which only a 32-bit version is available. It will then fail to load that library when the call to it is hit (so any problem might not be immediately apparent).
It’s also possible to force 32-bit mode using flags at runtime.