过去几个小时我一直在网上搜索,找到了很多与我的问题相关的信息 - 但实际上并没有修复它们。
我的机器是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,没有任何更改。
有人能以正确的方式指导我吗?
编辑 - 添加了截图,显示我无法为安装项目选择平台。
答案 0 :(得分:54)
您必须将安装项目标记为64位安装程序。您在“属性”窗口中的安装项目的TargetPlatform
属性,将其从x86(默认值)更改为x64。
另外,请确保部署64位版本的log4net,并确保C#项目的TargetPlatform
设置为Any CPU。
并确保您实际上需要您的应用程序以64位进程运行,这种情况很少见。
答案 1 :(得分:17)
答案 2 :(得分:7)
答案 3 :(得分:4)
答案 4 :(得分:1)
在安装时,如果目标计算机与指定平台不兼容,将引发错误并停止安装。
答案 5 :(得分:1)
这是因为 TragetPlatform 。
选择安装项目>属性,然后将TragetPlatform更改为x64。
答案 6 :(得分:0)
您可能需要安装x64 Windows服务(想想powershell),它需要与x86应用程序通信。你的答案(属性/ TargetPlatform)让我克服了这个障碍。
答案 7 :(得分:0)
这适用于Visual Studio 2010
转到您的项目>右键单击并选择Properties
。
在编译下,转到Advanced Compile Options
找到Target CPU
,然后找到
为x86
选择32bit systems
,为x64
选择64bit systems
或Any 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以外的东西再回来似乎已经成功了........