-1

I have a solution that was compiled with MSVC 12.0 Visual Studio 2013 (C++/CLI and C#) but only have Visual Studio 2015 (Community). I want to build the project using MSVC 12.0 as it was intended, as I only need to rebuild 1 part of the solution (of 5) for my purpose and want it to be compatible with the other DLLs. When trying to build it from MSVC 14.0 (Visual Studio 2015) it says:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v120 (Platform Toolset = 'v120') cannot be found.

Of course I installed the MS Build tools for 2013 (MSVC 12.0, v120) from here: https://www.microsoft.com/en-us/download/details.aspx?id=40760 as well as the Microsoft Visual C++ Redistributable 2013 package.

And the right directory for the 12.0 build tools install is C:\Program Files (x86)\MSBuild\12.0\Bin\amd64

It looks like a configuration error on the solution (or in Visual Studio in general) since it is looking for the build tools in the wrong directory. Does anyone know what settings I need to change / add in Visual Studio to get it to compile with MSBuild 12.0 instead of 14.0? I'd prefer not to install Visual Studio 2013 since I don't use it for anything else (just want to have the option to use VS 2013 MSBUILD within VS 2015 as needed).

halfer
  • 19,824
  • 17
  • 99
  • 186
Matt
  • 2,602
  • 13
  • 36
  • Not sure who downvoted this one, it is a question that hasn't been answered before on SO. I'm just trying to build a Visual Studio 2013 project using Visual Studio 2015 without installing Visual Studio 2013. I'm sure others have had this problem before when using an older project. If that person can comment on why the downvote I can clarify my question. – Matt Apr 08 '17 at 03:39
  • Have you try to override the ToolsVersion Settings of Projects and Solutions by using command prompt: msbuild.exe someproj.proj /tv:12.0? – Leo Liu Apr 12 '17 at 09:21
  • @Leo-MSFT Yes I did try however since they now embed the MSBuild commands into Visual Studio behind the scenes it doesn't seem to work. – Matt Apr 13 '17 at 00:14

3 Answers3

1

Okay I have gotten this working although in a roundabout way. Thanks others that have answered and commented. Sign up for a Microsoft Visual Studio Dev Essentials subscription for free. https://azure.microsoft.com/en-us/pricing/member-offers/vs-dev-essentials/ Then you can go through the menus and download Visual Studio Community 2013 by going to this link and finding it https://my.visualstudio.com/downloads. After doing so, you can build MSVC 12.0 from Visual Studio 2015. Sure, not perfect, but it works. I haven't tried uninstalling Visual Studio 2013 to see if it still works (Windows Phone SDK 8.1 is installed with 2013 as was mentioned to get it working in the Enterprise version of 2015) but if you could somehow keep that and remove the 2013 edition I believe it could work without 2013 installed...

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Matt
  • 2,602
  • 13
  • 36
  • Glad to know that you have resolved your issue. Please mark your answer which is benefit to other communities who has the same problem. Thanks. – Leo Liu Apr 17 '17 at 01:37
0

If you go to the top of your .vcxproj change it to this

<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

Then your .sln can still open in Visual Studio 2015

VisualStudioVersion = 14.0.25420.1

The reason is because the compiler version is specified on a project-by-project basis, and will override the solution version.

Cory Kramer
  • 114,268
  • 16
  • 167
  • 218
  • That is what is specified in the `vcsproj` project already. The issue appears to be that Visual Studio 2015 looks to `C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\` etc for the V12.0 build tools which are actually located here: `C:\Program Files (x86)\MSBuild\12.0\Bin\amd64` - was looking on how to signal to Visual Studio where to look for 12.0 build tools instead of the 14.0 path. – Matt Apr 07 '17 at 19:23
  • If you go to the project properties, what is under `General` > `Platform Toolset`? Is it set to `Visual Studio 2013 (v120)`? – Cory Kramer Apr 07 '17 at 19:28
  • `Visual Studio 2013 (v120) (not installed)` - I thought the build tools would be enough, maybe more dependencies? – Matt Apr 07 '17 at 20:12
0

I'd prefer not to install Visual Studio 2013 since I don't use it for anything else (just want to have the option to use VS 2013 MSBUILD within VS 2015 as needed).

You can install VS2013 toolset version from your VS2015 installer without installing visual studio 2013. From the 2015 installer, select Windows 8.1 and Windows Phone 8.0/8.1 Tools and common Tools for Visual C++ 2015:

enter image description here

After installation completed, you will find the platform Toolset below:

enter image description here

Then you can built your project with platform toolset Visual Studio 2013(v120).

You can refer to more info from the similar question on SO.

Community
  • 1
  • 1
Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • 1
    thanks for the above, I did see the post elsewhere but should have mentioned I'm using VS Community which doesn't have that option (while Enterprise does) – Matt Apr 10 '17 at 19:14
  • Yes, you are right. I have not noticed the different on the VS Community and Enterprise. It seems that you need to install the Visual Studio 2013 or try to use Visual Studio Enterprise. – Leo Liu Apr 11 '17 at 02:49