2015-09-12 25 views
10

Mam Visual Studio 2013 i 2015 zainstalowane obok siebie. Właśnie zmodernizowałem połączone rozwiązanie (C#, C++, C++/CLI) do roku 2015 i ustawiłem Toolset platformy na v140.Budowanie projektu Visual Studio 2015 C++ (v140) przez MSBuild Failed - v140 nie można znaleźć

Kompilacja z Visual Studio działa dobrze, ale nie można go skompilować z MSBuild. Używam skarg MSBuild 14 i MSBuild, które nie mogą znaleźć v140, ale to nonsens, ponieważ v140 jest zainstalowany na komputerze w "c: \ Program Files (x86) \ MSBuild \ Microsoft.Cpp \ v4.0 \ V140".

Nie można wykonać porady dotyczącej aktualizacji rozwiązania, ponieważ rozwiązanie jest już zaktualizowane i nie ma takiego elementu w menu kontekstowym rozwiązania.

Po przełączeniu narzędzi platformy projektu do wersji 120 działa.

Szczegóły:

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. 

UPDATE:

  • Istnieje jakiś projekt jest pomijany formularz Debug X86. Jest to zamierzone.
  • Projekt został pierwotnie utworzony w systemie VS2008, a następnie zaktualizowany do wersji VS2013, a następnie zaktualizowany do wersji VS2015.
  • Na tym komputerze zainstalowane są dwa Visual Studios (społeczności 2013 i 2015). 2013 został zainstalowany pierwszy, 2015 później.

ustawienia rejestru wygląda następująco: enter image description here

MS Build registry settings

Update2: Minimal, Complete, and Verifiable example

stworzyłem pusty C++ konsoli aplikacji w Visual Studio 2015:

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

#include "stdafx.h" 

int main() 
{ 
    return 0; 
} 

mogę zbudować go w Visual Studio, ale wobec tego samego problemu w 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:\> 

rozwiązany:

Środowisko zmienna VisualStudioVersion została ustawiona na 12,0 zamiast 14.0 Zmiana wartości na 14.0 rozwiązała problem.

Prosta aplikacja konsolowa zaczęła działać natychmiast po zmianie zmiennej środowiskowej VisualStudioVersion i wylogowaniu się z systemu Windows.

Po zmianie zmiennej środowiskowej VisualStudioVersion oryginalny projekt nadal nie mógł zostać utworzony. Menu kontekstowe rozwiązania retargetowego pojawiło się w Visual Studio 2015. Dlatego też ponownie dostosowuję rozwiązanie. Po ponownym kierowaniu rozwiązanie nadal nie mogło zostać skompilowane (nie znaleziono v140). Wreszcie zmieniłem zestaw narzędzi platformy od v140 (nie zainstalowany) do Visual Studio 2015 (v140).Teraz rozwiązanie można skompilować również z Visual Studio i MSBuild.

+1

Wiele osób stworzyło projekty C++ za pomocą zestawu narzędzi V140. VS 2015 nie zostałby wydany, gdyby nie było to możliwe. Twoja sytuacja wydaje się wyjątkowa i nie sądzę, że jest wystarczająco dużo informacji, aby ktokolwiek mógł ją rozwiązać. Możesz spróbować zobaczyć, czy możesz utworzyć MCVE. –

+0

Testowałem MCVE i mam ten sam problem. Link do podanego pliku zip. – qub1n

+1

Sprawdź, czy nie zdefiniowałeś zmiennej środowiskowej 'VisualStudioVersion' lub czy pliki rozwiązania i projektu nie definiują jej na nowo jako coś innego niż 14.xxx –

Odpowiedz

11

Problem polega na tym, że ustawiono zmienną środowiskową VisualStudioVersion na 12.0. To mówi MSBuildowi, aby używał narzędzi Visual Studio 2013 (V120), które nie obsługują narzędzi budujących Visual Studio 2015 (V140). Jeśli wyłączysz tę zmienną środowiskową lub przełączysz opcję MSBuild do projektu MSBuild, powinieneś ją skompilować. (Lub przynajmniej pomiń ten błąd).

Więcej informacji na temat zmiennej VisualStudioVersion można znaleźć w blogu MSDN pod tytułem Visual Studio project compatibility and VisualStudioVersion.

+0

Swoją drogą, nie ustawiłem samej zmiennej VisualStudioVersion na 12.0 . Może to być problem z instalacją VS2015 lub czymkolwiek. To dopiero co się stało. :-( – qub1n

+0

@ qub1n Instalacja VS 2015 nie ustawiłaby zmiennej środowiskowej VisualStudioVersion na 12.0. To, co ustawiłoby na 12.0, uruchamia jeden ze skryptów 'vcvars.bat' programu Visual Studio 2013. –

2

Jednym rozwiązaniem jest po prostu zmiana zestawu narzędzi platformy dostępnego w systemie. Potem wszystko dobrze.

Powiązane problemy