6

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

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.

But I get the following error:

[17:05:23]VCTargetsPath is c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\
[17:05:23]PlatformToolset is v120
[17:05:23]VCMessage
[17:05:23]c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32
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 MyCppProject\smCpp.vcxproj failed

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?

Many thanks

Brian

Redeemed1
  • 3,953
  • 8
  • 38
  • 63
  • related: [The builds tools for v120 (Platform Toolset = 'v120') cannot be found](http://stackoverflow.com/q/19801072/33499) – wimh Feb 04 '14 at 18:04
  • further research on this noted as a comment to the answer on @Wimmel 's link above – Redeemed1 Feb 06 '14 at 20:46
  • You need to install the Windows SDK for the appropriate version of the compiler. – Ade Miller Feb 12 '14 at 01:32
  • 1
    Yes Ade Miller, I tried that and then progressively installed extra components right up to a full VS 2013 install on our in-house TeamCity build environment and it still does fails in the same way. I also trialled each of a VS 2010, 2012 and 2013 (multiple .Net FX targets) C++ project in the visualstudio.com build service and observed the same failures on the 2013 projects. – Redeemed1 Feb 12 '14 at 14:18

1 Answers1

5

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)\MSBuild\12.0\bin"

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

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.

Team Build template

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

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.

Christian Maslen
  • 1,100
  • 9
  • 13
  • Thanks @Christian, that sounds like it is the answer to this. We found subsequently on another project that the new build template had to be picked up for what we were trying to do so this sounds very consistent. Your comment about build tooling being moved into VS first paragraph is particularly helpful too, and it explains a lot. – Redeemed1 Sep 15 '14 at 13:17
  • At first this didn't work for me until I found that there are two places in our template that we call MSBuild. I set both of those, then I also set "ToolPath" under the build definition, Process section, 4.0 Misc section to "C:\Program Files (x86)\MSBuild\12.0\Bin". I'm not sure if that made a difference, but setting both MSBuilds and that got me out of the weeds! – Jamie Sep 26 '14 at 19:19