无法使用 devenv 编译 vdproj - 'targeting 'x64'与项目的目标平台“x86”不兼容;
过去几个小时我一直在网上搜索,找到了很多与我的问题相关的信息 - 但没有一个真正解决它们。
我的机器是 64 位,安装了 32 位 Visual Studio 10。 解决方案使用.Net 4。 解决方案包括 Crystal Reports 的 64 位安装。 解决方案还包括 log4net。
在 VS2010 中编译项目对于任何 cpu 的 Debug 和 Release 都是可以的。
我添加了一个我想要构建的 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'
我尝试将项目的配置显式设置为 x86 和 x64,而不进行任何更改。
有人可以指导我正确的方法吗?
编辑 - 添加的屏幕截图显示我无法为安装项目选择平台。
I've been searching around the web for the past hours, finding a lot of information related to my problem - but none actually fixing them.
My machine is 64 bit with a 32 bit Visual Studio 10 installed.
Solution uses .Net 4.
Solution includes 64 bits installation of Crystal Reports.
Solution also includes log4net.
Compilation of project in VS2010 is OK for both Debug and Release, any cpu.
I have added a Web Setup Project that I want to build.
However, no matter the configuration I get the following errors when compiling (both within VS UI and command line using 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'
I have tried to explicitly set the configuration for the projects to both x86 and x64, without any change.
Can someone guide me on the right way?
Edit - added screenshot showing that I am unable to choose platform for the setup project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
您必须将安装项目标记为 64 位安装程序。在“属性”窗口中将安装项目的
TargetPlatform
属性从 x86(默认值)更改为 x64。另请确保部署 64 位版本的 log4net,并且 C# 项目的
TargetPlatform
设置为“任何 CPU”。并确保您确实需要您的应用程序作为 64 位进程运行,这种情况很少见。
You have to mark the Setup project as a 64-bit installer. Your Setup project's
TargetPlatform
property in the Properties window, change it from x86 (the default) to x64.Also make sure you deploy the 64-bit version of log4net and that your C# project's
TargetPlatform
setting is Any CPU.And make sure that you actually need your app to run as a 64-bit process, that's rare.
在 Visual Studio 中,您看不到任何更改,但您的项目现在是 AMD64。
In Visual Studio you don't see any changes, but your Project now AMD64.
<图片src="https://i.sstatic.net/pqtuX.png" alt="在此处输入图像描述">
这是因为 TargetPlatform。
选择安装项目>属性并将
TargetPlatform
更改为x64
。This is because of the TargetPlatform.
select the setup project > properties and change the
TargetPlatform
tox64
.安装时,如果目标计算机与指定平台不兼容,则会出现错误并停止安装。
At installation time, an error will be raised and installation will be halted if the target computer is not compatible with the specified platform.
您可能需要安装需要与 x86 应用程序通信的 x64 Windows 服务(例如 powershell)。您的回答(属性/目标平台)让我克服了这个障碍。
You may need an x64 Windows Service installed (think powershell) that needs to communicate to an x86 application. Your answer (properties/TargetPlatform) got me over that hurdle.
这是针对 Visual Studio 2010
转到您的项目 >右键单击并选择
属性
。在“编译”下,转到
高级编译选项
,找到
目标 CPU
,然后为
32 位系统
选择x86
,x64
适用于64 位系统
或任何 CPU
This is for Visual Studio 2010
Go to your Project > Right Click and select
Properties
.Under Compile, go to
Advanced Compile Options
Locate
Target CPU
, then eitherselect
x86
for32bit systems
,x64
for64bit systems
orAny CPU
我的 .net 2010 项目都包含 x86 和 x64 安装项目。我的项目的目标平台是任何 CPU,每个安装项目都有正确的 - CPU 特定 - 目标平台。所有这些都是“基线”.Net 项目的一部分,当我开始开发时,我将其“克隆”(复制然后用记事本编辑多个文件)到新项目中。多年来一直运作良好。
我在新项目中遇到此错误,直到执行以下操作后才发现修复:
更改项目属性>>编译>>进阶到任何 CPU 以外的东西然后再回来似乎已经扭转了局面......
My .net 2010 Projects all include an x86 and an x64 Setup Project. The TargetPlatform for my Projects is Any CPU and each Setup Project has the correct - CPU Specific - TargetPlatform. All this is part of a "baseline" .Net Project that I "clone" (copy then edit several files with NOTEPAD) into a new Project when I start development. Has worked great for years.
I encountered this error in a new project and found no fix until I did the following:
Changing the Project Properties >> Compile >> Advanced to something other than Any CPU and back again seems to have turned the trick........