【发布时间】: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