2015-09-12 16 views
10

Visual Studio 2013 ve 2015 yan yana yüklü var. Birleştirilmiş çözümü (C#, C++, C++/CLI) 2015'e yükselttim ve Platform Toolset'i v140'a ayarlıyorum.Yapı Visual Studio 2015 C++ projesi (v140) MSBuild tarafından Başarısız - v140 bulunamıyor

Visual Studio'nun yapısı iyi çalışıyor ancak MSBuild'den derlenemiyor. Ben v140 v140 bulamayan MSBuild 14 ve MSBuild şikayetlerini kullanıyorum, çünkü v140 "c: \ Program Files (x86) \ MSBuild \ Microsoft.Cpp \ v4.0 \ V140" bilgisayarda yüklü.

Çözümün yükseltilmesi ve çözüm bağlamında böyle bir öğenin olmaması nedeniyle çözümün yükseltilmesiyle ilgili öneriler yapılamaz.

Projenin Platform araçlarını v120'ye değiştirirsem çalışır.

Detayları:

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. 

GÜNCELLEME:

  • formu ayıklama X86'yı atlanır ediliyor bazı proje vardır. Bu kasıtlı.
  • Proje başlangıçta VS2008'de oluşturuldu, ardından VS2013'e yükseltildi, ardından VS2015'e yükseltildi.
  • Bu bilgisayarda iki Visual Studio yüklü var (2013 Topluluğu ve 2015 Topluluğu). 2013, daha sonra 2015 yılında kuruldu.

kayıt defteri ayarları benziyor: enter image description here

MS Build registry settings

Update2:

: Ben 2015 Visual Studio boş C++ konsol uygulaması yarattık Minimal, Complete, and Verifiable example

#include "stdafx.h" 

int main() 
{ 
    return 0; 
} 

Ben Visual Studio içinde inşa edebilirsiniz, ama ben MSBuild aynı durumla yüz yüze:

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:\> 

ÇÖZÜLDÜ:

Çevre değişken VisualStudioVersion yerine 12,0 olarak ayarlandı 14.0 Değeri 14.0 olarak değiştirmek sorunu çözdü.

Basit konsol uygulaması, VisualStudioVersion Environment değişkeni değiştirildikten hemen sonra ve Windows oturumu kapatıldıktan sonra çalışmaya başladı.

Özgün proje, VisualStudioVersion ortam değişkenini değiştirdikten sonra oluşturulamadı. Visual Studio 2015'te bir retarget çözüm bağlam menüsü belirdi. Bu yüzden çözümü tekrar hedefliyorum. Yeniden hedeflemeden sonra çözüm hala derlenemedi (v140 bulunamadı). Son olarak, v140 (yüklü değil)'dan Visual Studio 2015'e (v140) platform araç setini değiştirdim.Şimdi çözüm de Visual Studio ve MSBuild'den derlenebilir.

+1

Çok kişi, V140 araç seti ile C++ projeleri oluşturdu. VS 2015 mümkün olmamıştı serbest bırakılmamıştı. Durumunuz benzersiz görünüyor ve bunu çözmek için herkes için yeterli bilgi olduğunu sanmıyorum. Bir MCVE oluşturabileceğinizi görmeyi deneyebilirsiniz. –

+0

MCVE'yi test ettim ve aynı sorunla karşılaşıyorum. Sağlanan zip dosyasına bağlantı. – qub1n

+1

“VisualStudioVersion” ortam değişkenini tanımlamamış olmanız veya çözümünüzün ve proje dosyalarınızın 14xxx –

cevap

11

Sorununuz, VisualStudioVersion ortam değişkenini 12.0 olarak ayarlamanızdır. Bu, MSBuild'e Visual Studio 2015 (V140) oluşturma araçlarını desteklemeyen Visual Studio 2013 (V120) araçlarını kullanmasını söyler. Bu ortam değişkenini kaldırırsanız veya projenizi MSBuild'e /p:VisualStudioVersion=14.0 seçeneğini geçirirseniz, oluşturmalısınız. (Ya da en azından bu hatayı geçmiş olsun).

VisualStudioVersion değişkeni hakkında daha fazla bilgiyi Visual Studio project compatibility and VisualStudioVersion başlıklı bir MSDN blog girişinde bulabilirsiniz.

+0

'dan başka bir şey yeniden tanımlamamış olduğunu kontrol edin. Bu arada, VisualStudioVersion değişkenini 12.0 olarak ayarlamamıştım. . VS2015 kurulumu veya herhangi bir problemi olabilir. Henüz oldu. :-( – qub1n

+0

@ qub1n Visual StudioVersion ortam değişkeni 12.0'a ayarlanmadan VS 2015 yüklemesi, 12.0'a ayarlanmıştı, Visual Studio 2013 vcvars.bat komut dosyalarından birini çalıştırıyordu. –

2

Tek çözüm, sisteminizde bulunan platform araç setini değiştirebilmenizdir. O zaman iyi inşa edilir.

İlgili konular