5

We have a build script which uses MSBuild to build our solution. It has worked fine for VS2013, but it has broken since we installed VS2015 and upgraded. Initially, it failed with this error:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools. Alternatively, yo u may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgra de Solution...". [C:\Users\user\Documents\GitHub[snipped]Api.vcxproj]

So it was failing to build a C++ project since is seemed to default to using version 12 of MSBuild, even though it was a VS2015 project. So I added:

/tv:14.0

To the invocation of MSBuild to force it to use the right tools version. Now it fails with this:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(219,5): error MSB4175: The ta sk factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Build.Tasks.v12 .0.dll". Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Build.Tasks.v12.0.dll' or one of its dependencies. The system cannot find the file specified. [C:\Users\user\Documents\GitHub[snip].Api.vcxproj]

Now it's looking for a v12 assembly in the v14 folder. How do I fix this? I can't see any obvious place to make this change.

Note: The C++ project itself might be a red herring, the solution is mostly C# and this might just be the place where it loads in the tasks.

5Flags
  • 133
  • 8
  • Did you have a look at the C++ project file? You can unload the project file. Maybe someone has added some custom code. – Jeroen Heier Mar 24 '16 at 05:25
  • @Jeroen No changes as far as I can see. I created a new solution with just the vcxproj file in and the build fails with the same error. – 5Flags Mar 24 '16 at 05:51
  • What copy of msbuild is executed? Problem seems to happen when its the wrong msbuild version for me – paulm Apr 06 '16 at 09:56
  • @paulm - Yes, the problem was that the command prompt was being initialised with the VS2013 environment, rather than the 2015 environment. I think I had misunderstood the /tv option. As soon as I ran a correctly initialised command prompt all was well. – 5Flags Apr 11 '16 at 09:00
  • I am facing the same issue. @Avram can you explain what worked for you and answer your own question? – Ashwin Jul 18 '16 at 05:44
  • @NeoWin I opened the Visual Studio 2015 command prompt manually and ran the build from there. – 5Flags Jul 19 '16 at 07:22

0 Answers0