La construction de Visual Studio 2015 projet C++ (v140) par MSBuild a Échoué - v140 ne peut pas être trouvé

J'ai Visual Studio 2013 et 2015, installé de l'autre côté. J'ai juste mis à niveau la solution combinée (C#, C++, C++/CLI) d'ici à 2015 et jeu de Plateforme jeu d'Outils pour la v140.

Le construire à partir de Visual Studio fonctionne très bien, mais il ne peut pas être compilé à partir de MSBuild. J'utilise MSBuild 14 et MSBuild reproche est pas en mesure de trouver v140, mais c'est une absurdité, parce que v140 est installé sur l'ordinateur "c:\Program Files (x86)\MSBuild\Microsoft.Rpc\v4.0\V140".

L'avis à propos de la mise à niveau de la solution ne peut pas être fait, parce que la solution est déjà mis à niveau et il n'y a aucun élément dans la solution menu contextuel.

Si je change des outils de Plate-forme du projet de v120, il fonctionne.

Détails:

c:\git\hewerMaster>"c:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"  c:\git
\hewerMaster\Hewer.sln /property:Configuration=Debug /property:Platform=x86
Microsoft (R) Build Engine version 14.0.23107.0
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 9/12/2015 4:00:25 PM.
Project "c:\git\hewerMaster\Hewer.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|x86".
ValidateProjects:
The project "HewerDotNetWrapper" is not selected for building in solution con
figuration "Debug|x86".
The project "VisualHewer" is not selected for building in solution configurat
ion "Debug|x86".
The project "UnitTestWrapper" is not selected for building in solution config
uration "Debug|x86".
The project "ParamsFormatConverter" is not selected for building in solution
configuration "Debug|x86".
The project "UnitTestGenerator" is not selected for building in solution conf
iguration "Debug|x86".
The project "HewerUnitTestDotNet" is not selected for building in solution co
nfiguration "Debug|x86".
Project "c:\git\hewerMaster\Hewer.sln" (1) is building "c:\git\hewerMaster\Hewe
rRedirect\HewerRedirect.csproj" (2) on node 1 (default targets).
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with resp
ect to the input files.
_CopyAppConfigFile:
Skipping target "_CopyAppConfigFile" because all output files are up-to-date wi
th respect to the input files.
CopyFilesToOutputDirectory:
HewerRedirect -> c:\git\hewerMaster\anyCPU\Debug\pbrain-hewer.exe
Done Building Project "c:\git\hewerMaster\HewerRedirect\HewerRedirect.csproj" (
default targets).
Project "c:\git\hewerMaster\Hewer.sln" (1) is building "c:\git\hewerMaster\Hewe
r\Hewer.vcxproj" (3) on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.t
argets(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 bu
ild tools.  Alternatively, you may upgrade to the current Visual Studio tools b
y selecting the Project menu or right-click the solution, and then selecting "U
pgrade Solution...". [c:\git\hewerMaster\Hewer\Hewer.vcxproj]
Done Building Project "c:\git\hewerMaster\Hewer\Hewer.vcxproj" (default targets
) -- FAILED.
Done Building Project "c:\git\hewerMaster\Hewer.sln" (default targets) -- FAILE
D.
Build FAILED.

Mise à JOUR:

  • Il y a quelques projet ignorés forme de Débogage X86. Cela est intentionnel.
  • Le projet ont été initialement créé dans VS2008, puis mis à niveau vers VS2013, puis mis à niveau vers VS2015.
  • Il y a deux Visual studio installé sur cet ordinateur (2013 de la Communauté et 2015 de la Communauté). 2013 a été installé en premier, 2015 plus tard.

Les paramètres du registre ressemble:
La construction de Visual Studio 2015 projet C++ (v140) par MSBuild a Échoué - v140 ne peut pas être trouvé

La construction de Visual Studio 2015 projet C++ (v140) par MSBuild a Échoué - v140 ne peut pas être trouvé

UPDATE2:
Minimes, Complètes et Vérifiables exemple

J'ai créé des vides Application Console C++ dans Visual Studio 2015:

https://dl.dropboxusercontent.com/u/53387801/ConsoleApplication_v140.zip

#include "stdafx.h"
int main()
{
return 0;
}

Je peux le créer dans Visual Studio, mais je suis face au même problème dans MSBuild:

c:\>"c:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild" "C:\temp\vs2015_simplest\C
onsoleApplication1\consoleApplication1.sln"
Microsoft (R) Build Engine version 14.0.23107.0
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 9/16/2015 10:16:20 AM.
Project "C:\temp\vs2015_simplest\ConsoleApplication1\consoleApplication1.sln" o
n node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|x64".
Project "C:\temp\vs2015_simplest\ConsoleApplication1\consoleApplication1.sln" (
1) is building "C:\temp\vs2015_simplest\ConsoleApplication1\ConsoleApplication1
\ConsoleApplication1.vcxproj" (2) on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.t
argets(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 bu
ild tools.  Alternatively, you may upgrade to the current Visual Studio tools b
y selecting the Project menu or right-click the solution, and then selecting "U
pgrade Solution...". [C:\temp\vs2015_simplest\ConsoleApplication1\ConsoleApplic
ation1\ConsoleApplication1.vcxproj]
Done Building Project "C:\temp\vs2015_simplest\ConsoleApplication1\ConsoleAppli
cation1\ConsoleApplication1.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\temp\vs2015_simplest\ConsoleApplication1\consoleAppli
cation1.sln" (default targets) -- FAILED.
Build FAILED.
"C:\temp\vs2015_simplest\ConsoleApplication1\consoleApplication1.sln" (default
target) (1) ->
"C:\temp\vs2015_simplest\ConsoleApplication1\ConsoleApplication1\ConsoleApplica
tion1.vcxproj" (default target) (2) ->
(PlatformPrepareForBuild target) ->
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 = 'v1
40') cannot be found. To build using the v140 build tools, please install v140
build tools.  Alternatively, you may upgrade to the current Visual Studio tools
by selecting the Project menu or right-click the solution, and then selecting
"Upgrade Solution...". [C:\temp\vs2015_simplest\ConsoleApplication1\ConsoleAppl
ication1\ConsoleApplication1.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.14
c:\>

RÉSOLU:

Variable d'environnement VisualStudioVersion a été mis à 12.0 au lieu de 14,0 la Modification de la valeur à 14,0 résolu le problème.

La simple application console commencé à travailler immédiatement après la variable d'Environnement VisualStudioVersion changé et après déconnexion windows, connexion.

L'origine, le projet ne pouvait pas être construit après la modification de la variable d'environnement VisualStudioVersion. Une solution de reciblage menu contextuel est apparu dans Visual Studio 2015. J'ai donc réorienter la solution. Après le retargeting, la solution ne pouvait toujours pas être compilé (v140 pas trouvé). Finalement j'ai changé la plate-forme d'outils de v140 (non installé) à Visual Studio 2015 (v140). Maintenant, la solution peut être compilé à partir de Visual Studio et MSBuild.

Beaucoup de gens ont construit des projets C++ avec la v140 d'outils. VS 2015 n'aurait pas été libéré si cela n'avait pas été possible. Votre situation semble être unique et je ne pense pas qu'il y a assez d'informations pour quiconque de le résoudre. Vous pouvez essayer de voir si vous pouvez créer un MCVE.
J'ai testé MCVE et je suis face au même problème. Lien vers le fichier zip fourni.
Vérifiez que vous n'avez pas défini la variable d'environnement VisualStudioVersion, ou que votre solution et les fichiers de projet de ne pas redéfinir il autre chose que 14.x.x.x

OriginalL'auteur Tomas Kubes | 2015-09-12