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

时间:2011-08-05 12:53:51

标签: visual-studio-2010 build vdproj

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

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

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

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

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'

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

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

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

enter image description here

9 个答案:

答案 0 :(得分:54)

您必须将安装项目标记为64位安装程序。您在“属性”窗口中的安装项目的TargetPlatform属性,将其从x86(默认值)更改为x64。 另外,请确保部署64位版本的log4net,并确保C#项目的TargetPlatform设置为Any CPU。 并确保您实际上需要您的应用程序以64位进程运行,这种情况很少见。

答案 1 :(得分:17)

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

答案 2 :(得分:7)

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

答案 3 :(得分:4)

  1. 转到Visual Studio“查看”菜单,然后单击属性Windows:
  2. enter image description here

    1. 选择Target Framework x64位:
    2. enter image description here

答案 4 :(得分:1)

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

答案 5 :(得分:1)

这是因为 TragetPlatform

选择安装项目>属性,然后将TragetPlatform更改为x64。

enter image description here

答案 6 :(得分:0)

您可能需要安装x64 Windows服务(想想powershell),它需要与x86应用程序通信。你的答案(属性/ TargetPlatform)让我克服了这个障碍。

答案 7 :(得分:0)

这适用于Visual Studio 2010

转到您的项目>右键单击并选择Properties

在编译下,转到Advanced Compile Options

找到Target CPU,然后找到

x86选择32bit systems,为x64选择64bit systemsAny CPU

答案 8 :(得分:0)

我的.net 2010项目都包含x86和x64安装项目。我的项目的TargetPlatform是任何CPU,每个安装项目都有正确的 - 特定CPU - TargetPlatform。所有这些都是“基线”.Net项目的一部分,当我开始开发时,我“克隆”(复制然后用NOTEPAD编辑几个文件)到一个新项目中。多年来一直很好。

我在新项目中遇到此错误,在执行以下操作之前未找到任何修复:

- Open Project Properties >> Compile >> Advanced and set Target to x86
- "Build" x86 Setup Project
    - Build Success
- Changed Project Properties >> Compile >> Advanced Target to x64
- "Build" x64 Setup Project
    - Build Success
- Changed Project Properties >> Compile >> Advanced Target to Any CPU
- Build x86 Setup Project
    - Build Success
- Build x64 Setup Project
    - Build Success

更改项目属性>>编译>>高级到任何CPU以外的东西再回来似乎已经成功了........