我需要在 TeamCity 服务器或 Team Foundation Build Service 上为 C++ 项目/VS 2013 安装什么?

我正在尝试在 TC 8.0.6(内部版本 27767)上的 Visual Studio 2013 解决方案中构建 C++ 项目.

I am attempting to build a C++ project in a Visual Studio 2013 solution on TC 8.0.6 (build 27767).

我已经直接在服务器上安装了最新的 MSBuildMicrosoft Build Tools 2013"??(通常作为 VS 2013 安装的一部分安装).

I have installed the latest MSBuild "Microsoft Build Tools 2013" stuff (which is normally installed as part of VS 2013 install) directly on the server.

但我收到以下错误:

[17:05:23]VCTargetsPath is c:Program Files (x86)MSBuildMicrosoft.Cppv4.0
[17:05:23]PlatformToolset is v120
[17:05:23]VCMessage
[17:05:23]c:Program Files (x86)MSBuildMicrosoft.Cppv4.0PlatformsWin32
Microsoft.Cpp.Win32.Targets(512, 5): error MSB8008: Specified platform toolset (v120) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected.
[17:05:23]Project MyCppProjectsmCpp.vcxproj failed

据我所知,我拥有我需要的一切,我尝试了各种技巧来将 PlatformToolset 设置为 v110 等,但这也不起作用.

As far as I can see I have everything I need and I have tried various hacks to set the PlatformToolset to v110 etc., but that doesn't work either.

在这个阶段,我想确切地验证我需要在构建服务器上安装什么.有人可以澄清我是否需要额外的东西吗?

At this stage I would like to verify exactly what I need to install on the build server. Can someone clarify if I need anything extra please?

非常感谢

布莱恩

推荐答案

最终您需要设置正确的 MSBuild 路径.在 VS 2013 中,构建工具成为 VS 而不是 .NET 的一部分,使其成为 12.0 版而不是 4.0 版.此实例中的默认路径为:

Ultimately you need to set the correct path to MSBuild. With VS 2013, build tooling became part of VS rather than .NET, making it version 12.0 instead of 4.0. The default path in this instance is:

"C:Program Files (x86)MSBuild12.0in"

"C:Program Files (x86)MSBuild12.0in"

如果团队基础构建被破坏,那么很可能是因为 TF 服务器不是 2013 版本.要解决这个问题,您需要为自己制作构建定义使用的构建模板的副本(假设您的版本是 >= 2010和 < 2013) 并指向正确的工具文件夹.构建模板位于以下源路径中:

If the team foundation build is broken then it's likely because the TF server is not on version 2013. To fix the problem you need to make yourself a copy of the build template the build definition uses (assuming your version is >= 2010 and < 2013) and point to the correct tooling folder. The build templates are located in the following source path:

$/YourTeamProjectName/BuildProcessTemplates

$/YourTeamProjectName/BuildProcessTemplates

如果您可以在 Visual Studio 中编辑模板,则可以打开 Workflow Foundation 设计图面.在那里找到Run MSBuild for Project 任务(注意在默认模板中有多个,但我已经展示了要查找的内容的图片)并将工具路径属性更改为上述内容小路.

If you can edit the template in Visual Studio you open the Workflow Foundation design surface. In there find the Run MSBuild for Project tasks (note in the default template there is more than one, but I've shown a pic of what to look for) and change the tool path property to the above path.

创建模板后,您需要更改构建定义以使用新模板.

Once you created the template you need to change your build definition to use the new template.

对于 TeamCity,您需要在构建步骤中将 MSBuild ToolsVersion 设置为版本 12.0.我不确定什么版本的 TC 开始支持版本 12.

For TeamCity you need to set the MSBuild ToolsVersion to version 12.0 in your build step. I'm not sure what version of TC started support for version 12.

相关文章