What do I need to install for C++ project / VS 2013 on TeamCity server or Team Foundation Build Service?

12,159

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.

Share:
12,159
Redeemed1
Author by

Redeemed1

Many many years of internet-delivered Enterprise Systems using MS Technologies for Cloud and Web. Christian believer redeemed by Jesus. Guitarist, Song Writer and Music Producer with Nuendo

Updated on June 05, 2022

Comments

  • Redeemed1
    Redeemed1 almost 2 years

    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
    Redeemed1 over 9 years
    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.
  • Jamie
    Jamie over 9 years
    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!