我对Visual Studio 2008中的.NET平台构建选项有一些困惑.
什么是"任何CPU"编译目标,它生成什么类型的文件?我检查了这个"Any CPU"构建的输出可执行文件,发现它们是x86可执行文件(谁也看不到它!).那么,将可执行文件定位到x86与"任何CPU"之间有什么区别吗?
我注意到的另一件事是托管C++项目没有这个平台作为选项.这是为什么?这是否意味着我怀疑"任何CPU"可执行文件是普通的32位可执行文件是对的?
我似乎遇到了一个场景,当我在引用x64程序集的AnyCPU程序集上运行mstest时,我得到一个BadImageFormatException.
当AnyCPUTestingx64Production.dll测试程序集实现x64Production.dll中的接口(即使未使用)时,会出现此问题:
Unable to load the test container 'D:\AnyCPUTestingx64Production.dll'
or one of its dependencies. error details:
System.BadImageFormatException:
Could not load file or assembly 'x64Production, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Run Code Online (Sandbox Code Playgroud)
*** Assembly Binder Log Entry (09/02/2012 @ 09:44:26) …Run Code Online (Sandbox Code Playgroud)