无法使用devenv编译vdproj - 'targeting'x64'与项目的目标平台'x86'不兼容

son*_*abo 26 build vdproj visual-studio-2010

我一直在网上搜索过去几个小时,找到了很多与我的问题有关的信息 - 但没有一个真正修复它们.

我的机器是64位,安装了32位Visual Studio 10.解决方案使用.Net 4.解决方案包括64位Crystal Reports安装.解决方案还包括log4net.

在VS2010中编译项目对于Debug和Release,任何cpu都是可以的.

我添加了一个我想要构建的Web安装项目.但是,无论配置如何,编译时都会出现以下错误(在VS UI和命令行中使用devenv.exe):

ERROR: File 'CrystalDecisions.ReportAppServer.Prompting.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.Prompting.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.ObjectFactory.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.ObjectFactory.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.XmlSerialize.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.XmlSerialize.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.CommonObjectModel.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.CommonObjectModel.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.CommonControls.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.CommonControls.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.ReportDefModel.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.ReportDefModel.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'log4net.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'log4net.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.Controllers.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.Controllers.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.DataDefModel.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.DataDefModel.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.CubeDefModel.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.CubeDefModel.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.ClientDoc.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.ClientDoc.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
ERROR: File 'CrystalDecisions.ReportAppServer.CommLayer.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File 'CrystalDecisions.ReportAppServer.CommLayer.dll' targeting 'x64' is not compatible with the project's target platform 'x86'
Run Code Online (Sandbox Code Playgroud)

我试图将项目的配置显式设置为x86和x64,没有任何更改.

有人能以正确的方式指导我吗?

编辑 - 添加了截图,显示我无法为安装项目选择平台.

在此输入图像描述

Han*_*ant 56

您必须将安装项目标记为64位安装程序.您TargetPlatform在"属性"窗口中的安装项目属性,将其从x86(默认值)更改为x64.
还要确保部署64位版本的log4net,并确保C#项目的TargetPlatform设置为Any CPU.
并确保您确实需要您的应用程序作为64位进程运行,这是罕见的.

  • 属性窗口,而不是Project + Properties对话框.如有必要,请使用视图+属性窗口. (23认同)
  • Ahhhhhhhhhhhhhhhhh ......构建:13成功或最新,0失败,0跳过 (2认同)

小智 19

  1. 在记事本中打开Deployment.vdproj.
  2. 查找字符串"TargetPlatform"="3:0"
  3. 对于AMD64,更改为"TargetPlatform"="3:1",对于Itanium,更改为"TargetPlatform"="3:2"​​.
  4. 保存Deployment.vdproj.在Visual Studio中,您没有看到任何更改,但您的项目现在是AMD64.


小智 7

  1. 打开部署项目.
  2. 在Solution Explorer中,选择部署项目.
  3. 在"属性"窗口中,选择TargetPlatform属性.
  4. 为Intel Itanium 64位平台选择Itanium,或为任何其他64位平台(如AMD64和EM64T指令集)选择x64.
  5. 在安装时,如果目标计算机与指定平台不兼容,则会引发错误并停止安装.


小智 5

  1. 转到 Visual Studio“查看”菜单并单击“属性”窗口:

在此处输入图片说明

  1. 选择目标框架 x64 位:

在此处输入图片说明