共用方式為


MSB8006診斷程序代碼

本文說明MSB8006錯誤碼。

消息正文

MSB8006: The Platform for project '*project-name.vcxproj*' is invalid. Platform='*platform-name*'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Platform.

說明

當專案的平臺無效時,就會發生此錯誤。

平臺是一種建置目標架構,使用一組相符的C++建置工具和連結庫,或工具組。 Visual Studio 提供特定的平臺工具組,以建置 Win32 (x86)、x64、ARM 和 ARM64 Windows 目標。 它也支持選用的平臺工具組來建置 Linux、Android 和 iOS 目標。

Microsoft C++ 建置工具 (也稱為 MSVC 建置工具) 包含對應的架構特定版本的平臺工具集。 例如,Microsoft C++ 建置工具 v14.50 包含每個支援架構和目標的平臺工具集。

當您的專案指定平臺,但不是隨 Visual Studio 一起安裝的平臺,或 Visual Studio 找不到時,就會發生此錯誤。

解決辦法

使用 Visual Studio 安裝程式來安裝選用的平臺和工具組。 如需詳細資訊,請參閱 修改Visual Studio。 使用安裝程式中的 [ 個別元件 ] 索引標籤來選擇特定的平台、連結庫和 SDK。

大部分的專案不需要指定自定義平臺,但可以建立一個平臺。 如需詳細資訊,請參閱 Visual Studio C++ Project系統擴充性和工具組整合。 建立平臺的自定義 .props.targets 檔案之後,您可以在專案的 [ 屬性頁 ] 對話框中的 IDE 中選取它。

請確定您的專案是由參考專案所建置時載入。 確認您的專案是針對與參考專案相同的平臺所建置。

適用對象

MSBuild 的所有版本