VS 的編譯選項 build下的platform -- Any CPU和x86有什么影響?
現在的問題是,我的一個assembly用Any CPU編譯就不能在64位系統下運行了,但是用x86編譯就ok
原因是如果用Any CPU編譯,那么在64位機器默認的運行就是64位的,
而我的assembly需要調用一個32的COM庫,所以就運行不起來
只要用x86編譯,那么程序就是以32位的程序,依靠wow64來運行的,所以就ok
只要用x86編譯,那么程序就是以32位的程序,依靠wow64來運行的,所以就ok
所以,如果assembly需要使用win32庫的話,
那么編譯選項就不能使用默認的Any CPU了需要注意
我去,ANY CPU的意思不是任何CPU都可以用,而是當前編譯的這台機子的環境可用
大家可再了解一下
Mixed Platform vs Any CPU
Team Build deals with solution configurations - these are the platforms (e.g. .NET or Win32) and configurations (e.g. Debug or Release) you typically see in combo boxes within Visual Studio when you have a solution loaded (if you hover over these boxes the tooltips will say "Solution Platforms" and "Solution Configurations", respectively). When all of the projects in a solution are of the same type (e.g. C#/VB projects) the solution configurations will match up exactly with the project configurations. Once you have projects in a solution that have mismatched configurations/platforms, Visual Studio creates the solution level configuration(s) "Mixed Platforms/Debug" and possibly "Mixed Platforms/Release". These configurations are just mappings to individual project level configurations.
For example, if you have a C# project and a C++ project, typically "Mixed Platforms/Debug" will map to "Any CPU/Debug" for the C# project and "Win32/Debug" for the C++ project.
To see these mappings, open up the Configuration Manager (either through the Build menu or by clicking on the platform or configuration combo box and selecting Configuration Manager...). You should see combo boxes for the Active solution configuration and the Active solution platform and then a table showing you the project level mappings. This will show you the platform generated for each project under each solution configuration.
For example, if you have a C# project and a C++ project, typically "Mixed Platforms/Debug" will map to "Any CPU/Debug" for the C# project and "Win32/Debug" for the C++ project.
To see these mappings, open up the Configuration Manager (either through the Build menu or by clicking on the platform or configuration combo box and selecting Configuration Manager...). You should see combo boxes for the Active solution configuration and the Active solution platform and then a table showing you the project level mappings. This will show you the platform generated for each project under each solution configuration.
