1
votes

I have a solution that needs to build with TFS. C# projects and some of C++ projects are upgraded to .Net Framework 4.6 and Platform Toolset v140. but some of the third party C++ projects can't upgrade (They are in V110). MSBuild is not able to use the appropriate toolset version for projects. It returns this error:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets (44): The builds tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v140 to build using the v140 build tools.

Is there any way to get this to work? It is possible for MSBuild to build a solution which has projects with different Platform Toolsets?

Thank you, Arash

2
Did you need to manage your source code of the third party C++ projects? - PatrickLu-MSFT
I don't exactly know what you mean by manage. But what I can tell you is that in order to keep using them, I need to keep them in their current platform toolset (V110). However the rest of the projects (C++ and C#) are all upgraded. - Arash
I have a similar problem here: a solution with only C++ projects, one of them set to ToolsVersion="14.0" and using PlatformToolset>v140</PlatformToolset>, everything else using v120. When loading this into VS2013 (i.e. 12.0) it just ignores the v140 and builds like usual using v120. Same on the commandline using msbuild. Building everything in Visual Studio Online (which afaik is the new TFS?) though I get the exact same error as posted.. Why? - stijn
Solution: if I change the Visual Studio Version in the build definition in VS Online to Visual Studio 2015 everything builds, using msbuild 14, but it seems it figures out that the solution is made using VS2013 and as such it uses the v120 toolset for all projects, even the one which is set to v140. Not sure if this is of any help for you, but for me it basically means 'use the latest Visual Studio version in TFS and the rest worka automatically' - stijn
Unfortunately there is no much option in TFS! - Arash

2 Answers

0
votes

The problem solved by my Colleague Phil. Basically All you have to do is to change the MSBuild ToolPath property to point to right MSBuild version. As each version of MSBuild supports earlier versions, the highest used version of MSBuild should you point to.

So open the Build Process Template in Visual Studio and navigate to Microsoft.TeamFoundation.Build.Workflow.Activities.MSBuild. To get to there you should go to the following path:

Try Compile, Test and Associate ... -> Sequence -> Compile, Test, and Associate ... -> Try Compile and Test -> Compile and Test -> For Each Configuration in ... -> Compile and Test For ... -> If BuildSettings.HasProjectsToBuild -> For Each Project in BuildSettings... -> Compile Project and Copy -> Try to Compile the Project -> Compile the Project

Now right-click on "Run MSBuils for Projects" and select properties. Here you have a property "ToolPath" that you can specify the MSBuild address (in my case it is "C:\Program Files (x86)\MSBuild\14.0\Bin").

This should resolve the Problem.

Cheers,

Arash

-1
votes

You don’t need to specify your Platform Toolset in MSBuild Arguments for your projects.

I have try on my local enviroment.A solution including three projects C#(Platform Toolset v140), C++(Platform Toolset v140), C++(Platform Toolset v120).Without specify Platform Toolset in MSBuild Arguments. Build sucessful.