105

Using visual studio 2012 on windows 8 x64 aparantly this is caused by msbuild being moved into .net but I havn't seen how to fix it yet.

4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120 build tools.    
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5):
error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120 build tools.    
5>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120 build tools.
Lex Li
  • 60,503
  • 9
  • 116
  • 147
clienthax
  • 1,211
  • 2
  • 8
  • 12
  • 1
    CLI tip: To build any solution with preferred `PlatformToolset`, you can override it like so (VS2013): `"\Program Files (x86)\MSBuild\12.0\Bin\MSBuild" .\path\to\MySolution.sln /p:PlatformToolset=v120` (if you are in PowerShell, put `&` before `\Progr..`). For VS2015, it will become `"\Program Files (x86)\MSBuild\14.0\Bin\MSBuild"` and `/p:PlatformToolset=v140` and so on. – vulcan raven Aug 13 '15 at 06:30

16 Answers16

84

If you have VS2013 installed and are getting this error, you may be invoking the wrong MSBuild. With VS2013, Microsoft now includes MSBuild as part of Visual Studio. See this Visual Studio blog posting for details.

In particular, note the new location of the binaries:

On 32-bit machines they can be found in: C:\Program Files\MSBuild\12.0\bin

On 64-bit machines the 32-bit tools will be under: C:\Program Files (x86)\MSBuild\12.0\bin

and the 64-bit tools under: C:\Program Files (x86)\MSBuild\12.0\bin\amd64

The MSBuild in %WINDIR%\Microsoft.NET\Framework\ doesn't seem to recognize the VS2013 (v120) platform toolset.

Kevin Richardson
  • 3,592
  • 22
  • 14
  • 2
    This answer turned out to be the right answer for me when I experienced the same issue described in the OP. – Boinst Jun 25 '14 at 07:19
  • 12
    How do you change the path to MSBuild? – rharrison33 Sep 23 '14 at 01:24
  • What are you attempting to do? – Kevin Richardson Sep 23 '14 at 03:32
  • @KevinRichardson, I'm trying to set my MSBuild.exe path to the latest version. My command line builds are still using the older version. – rharrison33 Sep 24 '14 at 22:45
  • Probably best to post a new question and link it in the comments here. I think more information on your current process is needed than could be easily provided in a comment. – Kevin Richardson Sep 25 '14 at 06:46
  • 2
    @rharrison33 When I used a VS2013 command prompt, the correct version of msbuild was then used. Running a VS2012 command prompt used the incorrect msbuild location. Not really sure why VS2013 installed a VS2012 command prompt, but it's something to look out for... – Jim Geurts May 07 '15 at 02:43
  • When using VS2012 command prompt and explicitly using the correct msbuild, it still doesn't work. I'm assuming it's overriding a environmental variable or something. I only get it to work using VS2013 command prompt. (or a plain vanilla one) – Daniel Aug 14 '15 at 05:49
  • 1
    Building with the v120 toolset works for me in a VS2012 command prompt when I use `C:\Program Files (x86)\MSBuild\12.0\bin\MSbuild.exe`. – Kevin Richardson Aug 14 '15 at 06:00
75

http://en.wikipedia.org/wiki/Visual_C++

You are using Visual C++ 2012 which is v110. v120 means Visual C++ 2013.

So either you change the project settings to use toolset v110, or you install Visual Studio 2013 on this machine and use VS2013 to compile it.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • 74
    But, but... I get this error even though I have VS 2013 installed on my machine! – Tim Lovell-Smith Dec 10 '13 at 15:56
  • 5
    Did you get this resolved? I'm having similar issue. If I build from TFS Team Build, I get the same error. However, I can build fine from VS 2013 IDE and from a VS 2013 command prompt. – Ike Starnes Dec 16 '13 at 15:26
  • I checked the list of software installed on the TFS Build Servers here: http://listofsoftwareontfshostedbuildserver.azurewebsites.net/ where I presume this would work (I suspect this should build but I haven't got to try it yet). I note that VS 2013 is not actually installed, only some bits of it. – Redeemed1 Feb 05 '14 at 09:23
  • 7
    I installed VS 2013 on the build server and still have the problem. – Redeemed1 Feb 06 '14 at 20:38
  • Also, on my dev machine I only have 2013 installed so do not get any other options in the Toolset selection, so the second work-around (changing the toolset version) is not easily done – Redeemed1 Feb 06 '14 at 20:45
  • 4
    Note that your solution may have multiple projects. So, check Properties for all of them by right-click on project (not solution)->Configuration Properties->General->Platform Toolset (this is on VS2013) – pixel May 02 '16 at 23:47
  • Had a similar issue with VS 2017 RC in the end installed VS 2013 and still same problem but went back into Platform Toolset in project properties tried again from VS 2017 RC using "Visual Studio 2017 - Windows XP (v141_xp)" and this time it worked. – user692942 Feb 16 '17 at 13:01
  • If anyone has legacy code and comes across this question, I had an the same error with VS2010 Express. VS2010 *Express* does not have x64 toolset. So win32 will build fine, and x64 will build with an error MSB8032. You will need to install VS2010 Pro to build x64. – Hezi Dec 13 '20 at 11:12
69

if you are using visual 2012 right-click on project name -> properties -> configuration properties -> general -> platform toolset -> Visual Studio 2012 (v110)

StuWeldon
  • 677
  • 1
  • 7
  • 9
sara
  • 691
  • 4
  • 2
  • 1
    This solved it in my case. I tried using VS2013, then ran into this issue when I went back to VS2012. Note you must do this for every project in the solution. – J. Peterson Nov 04 '14 at 19:02
  • This post with a solution and directions are so clear and easy to follow.. Too bad 2012 still gives me a pile of errors, after I fixed that v110 problem.. I can run exactly the same C code runs on 2013 without issues, but 2012 can still manage to find errors. 2012 slows down coding, which is why I only use 2013 now. – T. Webster Apr 26 '15 at 20:55
  • Changed Platform Toolset and Windows SDK Version. Worked! – Fırat Esmer Mar 07 '18 at 11:07
13

Download and setup Microsoft Build Tools 2013 from http://www.microsoft.com/en-US/download/details.aspx?id=40760

Kim Ki Won
  • 1,795
  • 1
  • 22
  • 22
7

To add up to Kevin and Lex's answers:

We had a similar situation at work where both the developers and the build server had Visual Studio 2013. Our solution had a VS 2013 C++ project and compiled fine when built on developer's machine or on the build server within the IDE. The issue was when triggering builds using TFS build definitions. We were still using an old build template (version 11.1) instead of 12.0. Fortunately, a simple attribute addition to the template xaml file solved the issue. In the Sequence portion "Compile the Project", there is a xaml node that starts with

mtbwa:MSBuild CommandLineArgument=....

You can add a "ToolPath" attribute and point it to the right path of the MSBuild.exe you wish to invoke, based on Kevin's answer. For instance:

ToolPath="C:\Program Files (x86)\MSBuild\12.0\Bin"
Louis
  • 705
  • 10
  • 18
6

Wasted 4+ hours on this.

I have Visual Studio 2017 Enterprise, one of the projects has below error:

The builds tools for v120 (Platform Toolset = 'v120') cannot be found

To resolve above error, I tried to install all below:

However, none of the above worked.

Later, installed Visual Studio 2013 Ultimate, then all worked fine.

Looks like, the older Visual studio is a must to resolve this.

Hope it helps.

Manohar Reddy Poreddy
  • 25,399
  • 9
  • 157
  • 140
4

To add up to Louis answer:

Alternatively you can use the attribute ToolVersion="12.0" if you are using Visual Studio 2013 instead of using the ToolPath Attribute. Details visit http://msdn.microsoft.com/en-us/library/dd647548.aspx

So you are not forced to use absolute path.

kbisang
  • 558
  • 4
  • 13
3

When a VS2013 C++ project is opened in VS2015, and there are warnings about "The build tools for v120... cannot be found", I simply need to edit the .vcxproj file and change <PlatformToolset>v120</PlatformToolset> to <PlatformToolset>v140</PlatformToolset>, and close and re-open the solution.

1

In VS 2012, I was getting "SMB2 will not build: Error 1 error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools."

Throwing caution to the wind, I tried the suggestion: Selected the Solution in Solution Explorer, then clicked in the "Update VC++" menu item. This did some updateing and then started a build which succeeded.

The "Update VC++" menu item no longer appears in the solution menu.

1

i had a similar problem when i removed VS 2013 community Update 5 and switched over to VS 2015 community edition

and the problem acquired in windows phone 8.1 projects where it complained about not having the right msbuild toolset and about the emulators not installed even if they are.

i know that the source of the problem was the VS 2013 community settings that has been left by that last uninstall which messed everything for me even though the uninstall process went smooth with no problems from the control panel.

i did my best to remove any files left but there was always some thing left.

and what only fixed it for me is a fresh windows 10 x64 installation then after it i installed VS 2015 community edition and that's it!! no more errors for me and the wp8.1 emulator worked fine too!!

in my case now am completely sure that the previous visual studio install settings has messed everything for me and because there wasn't any way i found and tried to completely erase VS 2013 community files and settings i had to pay the price for it and reinstall my OS.

you might be able to avoid OS reinstall if you can find a way to completely erase last visual studio install files.

P.S:only attempt this solution(OS reinstall) after you tried every possible way first then if nothing works and only then ... make this solution as a last resort.

Joseph
  • 1,458
  • 15
  • 20
0

In VS2013 to set up all projects to correct build tools, you can do a right click on the solution in solution explorer and choose "Retarget solution". It will change all progects (all you check with the checkbox in opened dialog), so the error will be gone.

0

In my case, I have double-clicked a Visual 2013 sln file and Visual 2012 opened (instead of Visual 2013). Trying to compile with Visual 2012, a project that has the Platform Toolset set to "v120" showed the error above mentioned. However, reopening the sln with Visual 2013, the Platform Toolset was set to "Visual Studio 2013 (v120)" - please note the complete name this time -, actually did the job for me. The project compiles well now.

0

I was getting the same error with building USBView project in VS2015. I removed this error by selecting 'Platform Toolset' settings to to "Visual Studio 2015 (v140)" and than right click on solution (in VS2015) and select 'Retarget Solution' and selected 10.0.10240.0 on that dialog.

It seems like there is also ProjectUpgradeTool from microsoft which is suppose to convert older projects to upgrade to post VS2012 VS but I couldn't locate that tool on my machine.

I still have to fix some new linker error with help of this.

zar
  • 11,361
  • 14
  • 96
  • 178
0

I had a similar problem. VS 2015 Community (MSBuild 14) building a c++ app, wanted to use VS 2010 (v100) tools. It all came down giving msbuild an invalid configuration option. Strange.

So, recheck all those options and parameters.

James John McGuire 'Jahmic'
  • 11,728
  • 11
  • 67
  • 78
0

If you use make generators like cmake, JUCE, etc. try to set a correct VS version target (2013, 2015, 2017) and regenerate the solution again.

DenisKolodin
  • 13,501
  • 3
  • 62
  • 65
0

I was facing same issue while building some of project.

I used Visual Studio 2015 IDE, there it was working fine but while giving build from PowerShell script, it was giving toolset related "The builds tools for v140 (Platform Toolset = 'v140') cannot be found." error

So eventually it was issue of pointing to incorrect MSBUILD exe for the respective project.

Earlier I was pointing to $MSBUILD="C:\windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe

And build was successful when I updated script to point to $MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"

Hence to resolve the issue, please make sure to use correct MSBUILD.

Sagar Mahewar
  • 100
  • 1
  • 3