Unable to compile vdproj with devenv - 'targeting 'x64' is not compatible with the project's target platform 'x86''

喜你入骨 提交于 2019-11-29 01:49:47

问题


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.


回答1:


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.




回答2:


  1. Open Deployment.vdproj, in Notepad.
  2. Find string "TargetPlatform" = "3:0"
  3. Change to "TargetPlatform" = "3:1" for AMD64, or "TargetPlatform" = "3:2" for Itanium.
  4. Save Deployment.vdproj. In Visual Studio you don't see any changes, but your Project now AMD64.



回答3:


  1. Open a deployment project.
  2. In the Solution Explorer, select the deployment project.
  3. In the Properties window, select the TargetPlatform property.
  4. Choose either Itanium for an Intel Itanium 64-bit platform, or x64 for any other 64-bit platform (such as AMD64 and EM64T instruction sets).
  5. At installation time, an error will be raised and installation will be halted if the target computer is not compatible with the specified platform.



回答4:


  1. Go to Visual Studio "View" menu and click Properties Windows:

  1. Select Target Framework x64 bit:




回答5:


  1. Open a deployment project.
  2. In the Solution Explorer, select the deployment project.
  3. In the Properties window, select the TargetPlatform property.
  4. Choose either Itanium for an Intel Itanium 64-bit platform, or x64 for any other 64-bit platform (such as AMD64 and EM64T instruction sets).

At installation time, an error will be raised and installation will be halted if the target computer is not compatible with the specified platform.




回答6:


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.




回答7:


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 either

select x86 for 32bit systems, x64 for 64bit systems or Any CPU




回答8:


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:

- 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

Changing the Project Properties >> Compile >> Advanced to something other than Any CPU and back again seems to have turned the trick........



来源:https://stackoverflow.com/questions/6956601/unable-to-compile-vdproj-with-devenv-targeting-x64-is-not-compatible-with-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!