簡體   English   中英

無法使用 devenv 編譯 vdproj - 'targeting 'x64' 與項目的目標平台 'x86' 不兼容

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

過去幾個小時我一直在網上搜索,找到了很多與我的問題相關的信息 - 但沒有一個真正修復它們。

我的機器是 64 位的,安裝了 32 位的 Visual Studio 10。 解決方案使用 .Net 4。解決方案包括 Crystal Reports 的 64 位安裝。 解決方案還包括 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'

我試圖將項目的配置明確設置為 x86 和 x64,沒有任何更改。

有人可以指導我正確的方法嗎?

編輯 - 添加了屏幕截圖,顯示我無法為安裝項目選擇平台。

在此處輸入圖片說明

您必須將安裝項目標記為 64 位安裝程序。 在“屬性”窗口中,將安裝項目的TargetPlatform屬性從 x86(默認值)更改為 x64。
還要確保您部署了 64 位版本的 log4net,並且您的 C# 項目的TargetPlatform設置為 Any CPU。
並確保您確實需要您的應用程序作為 64 位進程運行,這種情況很少見。

  1. 在記事本中打開 Deployment.vdproj。
  2. 查找字符串 "TargetPlatform" = "3:0"
  3. 對於 AMD64,更改為 "TargetPlatform" = "3:1",對於 Itanium,更改為 "TargetPlatform" = "3:2"。
  4. 保存 Deployment.vdproj。 在 Visual Studio 中,您看不到任何更改,但您的項目現在是 AMD64。
  1. 打開部署項目。
  2. 在解決方案資源管理器中,選擇部署項目。
  3. 在“屬性”窗口中,選擇 TargetPlatform 屬性。
  4. 為 Intel Itanium 64 位平台選擇 Itanium,或為任何其他 64 位平台(如 AMD64 和 EM64T 指令集)選擇 x64。
  5. 安裝時,如果目標計算機與指定平台不兼容,將引發錯誤並暫停安裝。
  1. 轉到 Visual Studio“查看”菜單並單擊“屬性”窗口:

在此處輸入圖片說明

  1. 選擇目標框架 x64 位:

在此處輸入圖片說明

這是因為TragetPlatform

選擇安裝項目 > 屬性並將 TragetPlatform 更改為 x64。

在此處輸入圖片說明

  1. 打開部署項目。
  2. 在解決方案資源管理器中,選擇部署項目。
  3. 在“屬性”窗口中,選擇 TargetPlatform 屬性。
  4. 為 Intel Itanium 64 位平台選擇 Itanium,或為任何其他 64 位平台(如 AMD64 和 EM64T 指令集)選擇 x64。

安裝時,如果目標計算機與指定平台不兼容,將引發錯誤並暫停安裝。

您可能需要安裝需要與 x86 應用程序通信的 x64 Windows 服務(想想 powershell)。 您的回答(屬性/TargetPlatform)讓我克服了這個障礙。

這是用於 Visual Studio 2010

轉到您的 Project > Right Click 並選擇Properties

在編譯下,轉到Advanced Compile Options

找到Target CPU ,然后

32bit systems選擇x86 ,為64bit systems選擇x64Any CPU

我的 .net 2010 項目都包括一個 x86 和一個 x64 安裝項目。 我的項目的 TargetPlatform 是 Any CPU,每個安裝項目都有正確的 - CPU 特定 - TargetPlatform。 所有這些都是我在開始開發時“克隆”(復制然后用記事本編輯幾個文件)到一個新項目中的“基線”.Net 項目的一部分。 多年來一直工作得很好。

我在一個新項目中遇到了這個錯誤並且在我執行以下操作之前沒有找到修復:

- 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 以外的其他內容並再次返回似乎已經解決了這個問題........

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM