简体   繁体   English

如何从x64构建应用程序?

[英]How build app from x64?

I create application in visual studio 2010. I tested on server 2003 r2 x64 and the program does not start. 我在visual studio 2010中创建应用程序。我在服务器2003 r2 x64上测试,程序无法启动。 trying to compile x64 and I crash exception 试图编译x64,我崩溃异常

Error while Trying to run Project: Debugger cannot start: The assembly to be debugged was built with platform incompatible with the current system 尝试运行项目时出错:调试器无法启动:要调试的程序集是使用与当前系统不兼容的平台构建的

If your application references 32-bit .dll-files it can't run as 64-bit. 如果您的应用程序引用32位.dll文件,则它无法以64位运行。 Either .Net assemblies compiled to x86-target (which is default now), or P/Invoke on native Windows .dll-files, will prevent you from running your 64-bit app. 编译为x86-target(现在是默认值)的.Net程序集或本机Windows .dll文件上的P / Invoke将阻止您运行64位应用程序。

The Windows installation you are running this on also needs to be 64-bit in order for it to handle 64-bit debugging. 您运行此操作的Windows安装也需要为64位才能处理64位调试。 (Note: Compiling to 64-bit will work fine!) (注意:编译为64位将正常工作!)

Set target CPU type to x86 in project properties (under Build) to make it work. 在项目属性(在Build下)中将目标CPU类型设置为x86以使其工作。 If you don't reference any external 32-bit .dll's you can set it to "any" to let .Net decide. 如果你没有引用任何外部32位.dll,你可以将它设置为“any”让.Net决定。 It will then run 64-bit mode on 64-bit operating systems and 32-bit mode on 32-bit operating systems. 然后,它将在64位操作系统上运行64位模式,在32位操作系统上运行32位模式。

我不确定VS2010,但对于VS2005,我使用“混合平台”为“主动解决方案平台”设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM