【问题标题】:MS Build Error MSB8007: The Platform for project 'MyProject.vcxproj' is invalid. Building a Visual Studio project against a custom SDK using MSBuildMS 构建错误 MSB8007:项目“MyProject.vcxproj”的平台无效。使用 MSBuild 针对自定义 SDK 构建 Visual Studio 项目
【发布时间】:2014-08-28 21:27:42
【问题描述】:

您好,我遇到了 MSBuild 错误问题。它最初是在尝试通过 TFS 设置自动构建时发现的,但使用 MSBuild 针对本地构建进行了测试。

尝试使用 MSBuild 通过命令行构建 VisualStudio 2013 项目时发生错误。该项目在 VisualStudio 中打开时构建良好。这是一个基于 Windows Embedded Compact 2013 SDK 构建的简单项目。我知道 .sln 文件和 .vcxproj 文件是有效的,因为它们是通过 VisualStudio 自动创建的。此外,它们为 VisualStudio 中的所有配置构建得很好。

为了让 MSBuild 能够使用我指定的 SDK,需要做些什么特别的事情吗?报错全文(略删项目名)如下:

d:\TFS\Projects\MyProject>C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe MyProject.sln
Microsoft (R) Build Engine version 4.0.30319.18408
[Microsoft .NET Framework, version 4.0.30319.18444]
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 8/28/2014 3:55:14 PM.
Project "d:\TFS\Projects\MyProject\MyProject.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|Am335xSDK".
Project "d:\TFS\Projects\MyProject\MyProject.sln" (1) is building "d:\TFS\Projects\MyProject\MyProject\MyProject.vcxproj" (2) on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'MyProject.vcxproj' is invalid.  Platform='Am335xSDK'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Platform that doesn't exist for this project. [d:\TFS\Projects\MyProject\MyProject\MyProject.vcxproj]
Done Building Project "d:\TFS\Projects\MyProject\MyProject\MyProject.vcx
proj" (default targets) -- FAILED.

Done Building Project "d:\TFS\Projects\MyProject\MyProject.sln" (default targets) -- FAILED.


Build FAILED.

"d:\TFS\Projects\MyProject\MyProject.sln" (default target) (1) ->
"d:\TFS\Projects\MyProject\MyProject\MyProject.vcxproj" (default target)
 (2) ->
(InvalidPlatformError target) -> C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.InvalidP
latform.Targets(23,7): error MSB8007: The Platform for project 'MyProject.vcxproj' is invalid.  Platform='Am335xSDK'. You may
be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Platform that doesn't exist for this project. [d:\TFS\Projects\MyProject\MyProject\MyProject.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.08

【问题讨论】:

    标签: c++ visual-studio msbuild build-error


    【解决方案1】:

    我今天能够解决我的问题。我安装的 SDK 是针对 V12 MSBuild 工具集安装的。在上述错误中,我是针对安装了 .net 框架的旧版 MSBuild 进行构建的。通过针对正确的工具链运行构建,它解决了这个问题。

    我最初发现该问题的自动构建工具链也存在类似问题。我们为 TFS 设置的自动构建工作流使用了 TFS2012 的默认模板设置。这是针对旧版本的 MSBuild 工具集构建的。按照位于此处的指南:

    Building Visual Studio 2013 solutions with your TFS 2010 / 2012 Build Templates

    我能够更新我们的 TFSBuild 工作流程,为 VisualStudio 2013 构建选择正确的工具链。

    【讨论】:

      猜你喜欢
      • 2012-09-03
      • 2018-03-03
      • 2019-09-24
      • 1970-01-01
      • 2013-09-01
      • 1970-01-01
      • 2021-05-25
      • 2017-12-05
      • 1970-01-01
      相关资源
      最近更新 更多