Any Platform, x86, x64… Continued
Further study of the problem on platform target enlightened me that the cause is by using assemblies, compiled with x86 target. As indicated by Stilgar, these can be any wrappers around 32-bit native code, or COM interops to 32 native COM objects, or any assembly, compiled to target x86. Examples I know include Managed DirectX assemblies, XNA Framework.
Similarly, trying to run a x64 assembly on 32-bit Windows will also fail. Mixing 32-bit and 64-bit code in one application is a “no-no”.
In my case I was referencing a COM object, created in Borland Delphi (obviously native 32-bit code, Delphi still can’t compile 64-bit native).
In short, when you migrate your code to x64, or you want to be sure it will run on 64-bit Windows, please check carefully your dependancies, and pick your platform target accordingly.
Further problems you can have when moving to 64-bit code is the size of datatypes (for example, IntPtr is now 8 bytes instead of 4). I suggest you read this article at MSDN.