MS Build Error MSB8007:项目“MyProject”的平台。vcxproj”是无效的。使用MSBuild构建一个针对自定义SDK的Visual Studio项目。

时间:2022-06-26 13:44:18

Hello I'm having issues with an MSBuild Error. It was originally discovered while trying to setup an automated build through TFS but was tested against a local build using MSBuild.

你好,我有一个MSBuild错误的问题。它最初是在尝试通过TFS建立自动构建时被发现的,但是通过MSBuild对本地构建进行了测试。

The error occurs when attempting to build a VisualStudio 2013 project through the command line using MSBuild. The project builds fine when opened in VisualStudio. It is a simple project that builds against a Windows Embedded Compact 2013 SDK. I know that the .sln file and .vcxproj files are valid as they were created automatically though VisualStudio. In addition, they build just fine for all configurations from within VisualStudio.

当尝试使用MSBuild在命令行中构建VisualStudio 2013项目时,会出现错误。当在VisualStudio中打开时,项目构建良好。它是一个简单的项目,构建于一个Windows嵌入式紧凑的2013 SDK。我知道.sln文件和.vcxproj文件是有效的,因为它们是通过VisualStudio自动创建的。此外,它们还可以为VisualStudio中的所有配置构建良好的结构。

Is there anything special that needs to be done for MSBuild to be able to use the SDK that I am specifying? The full text of the error (slightly edited to remove project names) is as follows:

对于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

1 个解决方案

#1


0  

I was able to resolve my issue today. The SDK's that I had installed where installed against the V12 MSBuild toolset. In the above error I was building against an older MSBuild version installed with the .net framework. By running the build against the correct toolchain it fixed the issue.

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

It was a similar problem for the automated build toolchain that I originally discovered the issue on. The automated build workflow that we had setup for TFS used the default template settings for TFS2012. This was building against an older version of the MSBuild toolset. Following the guide located here:

我最初发现这个问题的自动化构建工具链也是类似的问题。我们为TFS设置的自动构建工作流使用了TFS2012的默认模板设置。这是针对一个老版本的MSBuild工具集。以下是指南:

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

使用您的TFS 2010 / 2012构建模板构建Visual Studio 2013解决方案。

I was able to update our TFSBuild workflow to select the correct toolchain for VisualStudio 2013 Builds.

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

#1


0  

I was able to resolve my issue today. The SDK's that I had installed where installed against the V12 MSBuild toolset. In the above error I was building against an older MSBuild version installed with the .net framework. By running the build against the correct toolchain it fixed the issue.

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

It was a similar problem for the automated build toolchain that I originally discovered the issue on. The automated build workflow that we had setup for TFS used the default template settings for TFS2012. This was building against an older version of the MSBuild toolset. Following the guide located here:

我最初发现这个问题的自动化构建工具链也是类似的问题。我们为TFS设置的自动构建工作流使用了TFS2012的默认模板设置。这是针对一个老版本的MSBuild工具集。以下是指南:

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

使用您的TFS 2010 / 2012构建模板构建Visual Studio 2013解决方案。

I was able to update our TFSBuild workflow to select the correct toolchain for VisualStudio 2013 Builds.

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