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
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
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.