2014-08-28 25 views
1

您好,我遇到了MSBuild错误。它最初是在尝试通过TFS设置自动构建时发现的,但是使用MSBuild针对本地构建进行了测试。MS生成错误MSB8007:项目'MyProject.vcxproj'的平台无效。使用MSBuild针对自定义SDK构建Visual Studio项目

尝试通过命令行使用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 

回答

0

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

这是我最初发现问题的自动构建工具链的类似问题。我们为TFS设置的自动构建工作流程使用了TFS2012的默认模板设置。这是针对较旧版本的MSBuild工具集构建的。继位于莅临指导:

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

我能更新我们TFSBuild工作流程来选择正确的工具链的VisualStudio 2013版本。

相关问题