What is the relationship between a .NET assembly and "bitness" or properly speaking, CPU architecture? I thought that .NET programs are compiled into CIL (bytecode) and that they might end up running in different architectures, and will be just-in-time compiled automatically. Thus there should be no "bitness" to a .NET assembly.
But the real world doesn't seem to be so simple. I test programs on a 64-bit machine and frequently run into weird compatibility issues between, say, my program and another .NET library. So my questions are:
- Can a .NET binary somehow have a CPU architecture built into it?
- Under what conditions does/should this happen?
- On 64-bit machines, what chain of events results in .NET code being run in a 32-bit environment?
BTW: this question (Differences between 32 and 64-bit .NET (4) applications) and its top answer take for granted that there is a definite bitness for .NET applications. But I see no way of setting the architecture in Visual Studio.