The build tools for Visual Studio 2008 (Platform Toolset = 'v90') cannot be found - c++

I'm trying to build project c++ on vs2017 but there error appear:
"The build tools for Visual Studio 2008 (Platform Toolset = 'v90') cannot be found " after navigation, I must download VS 2008 I have installed it, but problem still exist .
any Suggestion ?

You need:
An MSVC 9.0 compiler toolchain
https://wiki.python.org/moin/WindowsCompilers lists the products that have it:
VS 2008, "Visual C++" feature and "x64 compilers and tools" subfeature
Express edition only has x86 compilers
Do install SP1 on top of VS2008 -- in vanilla VS2008 installer, installation for many features, including x64 compilers, is broken
WinSDK 6.1
WinSDK 7.0
"Visual C++ Compiler for Python 2.7" package
MsBuild 4.0 toolset configuration files for the above toolchain. (These are the directories c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\<arch>\PlatformToolsets\v90\ with .props and .targets files in them)
The only product I know that has this package is VS 2010 ("Visual C++" feature and "x64 compilers and tools" subfeature).
(WinSDK 7.1 technically has it, too, but its setup is riddled with bugs and broken on an x64 system.)
(You can bypass the buggy installer though if you install <GRMSDK_EN_DVD.iso>\Setup\vc_stdx86\vc_stdx86.msi directly. Despite the name, it has toolset files for all 3 platforms.)
"Visual C++ Compiler for Python 2.7" package is not supported by these toolset configuration files. So if you use it, you'll need to either manually specify its location in one of registry values specified in .props, or modify .props to also look in HKLM\Software\Microsoft\DevDiv\VCForPython.

The projects are targeting the v90 platform toolset. The solution is to either open the .sln file with VS2008 (i.e. use the right tool), or spend some time updating the projects to target the latest platform toolset (i.e. VS2017). To do that, just right click each project, and go to Properties, then look at General | Windows SDK Version. You may have to fix compilation / linker errors following the project upgrade.

It is possible to upgrade the project file from the command line without opening it in Visual Studio. I was running into the same issue, and found another solution in the Microsoft documentation for Visual Studio (https://learn.microsoft.com/en-us/visualstudio/ide/reference/upgrade-devenv-exe?view=vs-2017).
Here are the steps:
Open the developer command prompt for you version of Visual Studio, e.g. 'Developer Command Prompt for VS 2017'.
Navigate to the directory of your project file.
Execute the following command: devenv myproject.sln /upgrade

Related

Change Platform Toolset when compiling from CMD

I would like to compile a C++ program via Visual Studio command line tools. I would like to target the executable for 32 bit Windows XP. Tried compiling it the usual way, using x86 Native Tools Command Prompt for VS 2019, but it doesn't work on Windows XP, though runs fine on my Windows 10 machine.
Steps I take:
Open x86 Native Tools Command Prompt for VS 2019.
cd to the project directory. There I'll have 2 folders sources and headers, which shall contain .cpp and .h files respectively.
Execute command cl sources\*.cpp /EHsc /D_WIN32_WINNT=0x050103 /I headers /I <path to boost> /link /libpath <path to boost>\boost_1_77_0\bin\x86\lib\libboost_program_options-vc142-mt-s-x32-1_77.lib /out:exec_xp.exe (the project uses the boost library).
Tried this, but it doesn't work. /D \"_USING_V110_SDK71_\" seems to do nothing, and the /SUBSYSTEM:WINDOWS,5.01 piece isn't recognized by the compiler.
I have learnt from this Microsoft page that we should install deprecated Toolset to compile for WinXP. I went ahead to Visual Studio Installer and installed the C++ Windows XP Support for VS 2017 (v141) tools [Deprecated], as said in the tutorial.
But what now? How can I use this Toolset? I can't find it anywhere on my computer, let alone use it! Visual Studio Installer says it's located under C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools, but it's too vague.
UPD:
Tried with msbuild /p:PlatformToolset=v141_xp, getting this error:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(439,
5): error MSB8020: The build tools for v141_xp (Platform Toolset = 'v141_xp') cannot be found. To build using the v141_
xp build tools, please install v141_xp 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 "Retarget solution"
Which suggests, the compiler doesn't see the v141_xp toolset. I wonder why? It's installed for sure, I did it via the Visual Studio Installer.
I suggest you could try to set the PlatformToolset property:
msbuild myProject.vcxproj /p:PlatformToolset=…
For more details, I suggest you could refer to the Doc:MSBuild command-line reference

Visual Studio Platform 2015 Toolset ='v141' cannot be found

I'm trying to compile a project using OpenFrameworks (a library which uses C++) in Visual Studio. The build is set to Release and X64 and in the project properties I have set the Platform Toolset to Visual Studio 2015 (v140)
However every time I try to build the project I get the same error (amongst others)
Error MSB8020 The build tools for v141 (Platform Toolset = 'v141')
cannot be found. To build using the v141 build tools, please install
v141 build tools.
I know v141 is from the new version of MSVS 2017 but I do not want to upgrade to as the new version is not compatible with OpenFrameworks. I have tried rebuilding the project from scratch several times and have also looked into the VCXPROJ file and verified that everything is set to V140 - and it is. All very bizarre.
It seems that on build, something is setting a requirement for v141 but I cannot seem to find where this is coming from. Does anyone have an idea?
I had such an issue. The solution is: open menu "Project"->Properties->Configuration Properites->General - and choose platform toolset v140.
Had this same error trying to npm install after cloning a node based project. It had an npm dependency that required C++ source to be compiled.
I had already modified my VS2017 install to include Individual Components -> VC++ 2017 version 15.7 v14.14 latest v141 tools
but that didn't help.
I applied these commands in succession
npm install -g node-gyp
npm install --global --production windows-build-tools
The first had no effect but the second did the trick and the npm install command completed successfully after that.
This was addressed in the comments of one of the answers, but it worked for me. I had both v140 and v141 build tools installed, so when I had to use v140 build tools for something, I set the VCTargetsPath variable to the path of the v140 build tools. Deleting this variable in my environment variables ultimately fixed this issue for me.
For this error, and similar, for other platforms (e.g. VS2013) this problem typically occurs because you installed an older version of VS after you installed a later one. It's my observation that this will effect all of your Visual Studio C++ projects, and you will have to manually set them to target the specific toolset for the given version of VS you are trying to build the project under.
If anyone has the same issue..
Reason: When someone tries to open existing solution which created/build on latest VS version (VS2015 / 2017) and tried to open with backward / old version of VS instance. Then this error might occur.
Please try below steps.
Right click Project->Properties->Configuration Properties.
Set 'Target Platform Version' as Supported OS version, i.e. for 8.1 > Win7 & 10 Win10
Set 'Platform tool set' as installed visual studio version.
Re-Build & Enjoy :)
I had that v141 error when building from command-line but not inside visual studio:
The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 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 "Retarget solution".
Turns out it was because I was calling the wrong vcvars so I was using the wrong version of msbuild.exe:
:: wrong (Visual Studio 2015)
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 >NUL
:: correct (Visual Studio 2017)
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" x64 >NUL
Not sure it's possible for this to be the error inside visual studio, but I hope this is helpful to some future searcher...

MSbuild Error: The builds tools for v140 (Platform Toolset = 'v140') cannot be found

I have a solution which is consists of a large number of projects (C++ and C#). I upgraded the solution to VS2015, so the toolset version for most of them are now set to V140, but a small number of projects need to remain in V110 (third party libraries, etc). When I build the solution in Visual Studio 2015, it builds just fine, but when TeamFoundationServer tries to build it, it fails with the following error:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets (44): The builds tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install v140 to build using the v140 build tools.
I tried to specify the VisualStudioVersion or the path to the right MSBuild version as build arguments, but it didn't work as the rest of the projects (the ones in V110) will be in trouble.
Any help would be very appreciated.
I had the same issue. Steps given in this Solution helped me solve my issue. Repeating the steps here for future reference.
If you're attempting to build a Win32 "Desktop" application, the easiest way to get the v140 Platform Toolset is via the Visual Studio Installer (please see the image, below, for an illustration of steps '3.' and '4.'):
Launch the "Visual Studio Installer" from your start menu.
Select "Modify" for the instance of Visual Studio 2017 you have
installed.
Under the "Summary" pane of the workload selector, click the
"Desktop development with C++" expander (if it is collapsed)
Check the "VC++ 2015.3 v140 toolset (x86,x64)" optional feature.
The builds tools for v140 that's the platform toolset for VS2015.
If you are using TFS2015, you must make sure the build environment on your build machine be the same as your local developer machine. You should install VS2015 on your build machine.
If you are using TFS2013 or TFS2012, most probably MSBuild 12.0 is called.You need to set the build templates to point to MS Build version 14.0. For the details, check: TFS 2013 building .NET 4.6 / C# 6.0
Jacob's answer worked for me but C++ build tools were under VS Build Tools 2017 while I had VS 2019 Installer on Windows 10 as at July, 2019.
You're trying to build using a different version of the build toolset that is either not installed on your system or that the project can't use. To change it to something that you have installed on your system, right click on the project in your Solution Explorer.
Go to Properties. Configuration Properties>General>Platform Toolset>(Change this to a toolset that is installed on your system).
Make sure you do this for the Debug and Release builds
For the folks who are trying to do the same with Visual Studio Build Tools 2022, you may find this under Optional when choosing Desktop development with C++ Workload. Also, I had to update below variables in Environment variables to point to the new location.
Path: replace previous path for BuildTools with C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin
VCTargetsPath: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170
VS140COMNTOOLS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\ PS: I didn't have to change the value. But this setting was needed for me to work.
If you are using Visual Studio 2022 Build Tools, then the following PowerShell script will fix it:
$VS_BTOOLS_EXE="vs_buildtools.exe"
$VS_BTOOLS_URI="https://aka.ms/vs/17/release/vs_buildtools.exe"
Invoke-WebRequest -Uri $VS_BTOOLS_URI -OutFile $VS_BTOOLS_EXE
Start-Process -FilePath ./vs_BuildTools.exe -ArgumentList `
"--add", "Microsoft.VisualStudio.Component.VC.140", `
"--quiet", "--norestart", "--force", "--wait" -Wait -PassThru
Useful when silent installation is needed as well.
Jacob's answer worked for me, but I had to click on the "Individual components" tab at the top for my Step 3.
image
This solution worked perfectly for me: https://social.msdn.microsoft.com/Forums/vstudio/en-US/e0b9c601-2ece-4dcc-bac3-23ed7dd6801a/the-builds-tools-for-v120-platform-toolset-v120-cannot-be-found?forum=vclanguage

Is there a way to list library dependencies in Visual Studio?

I'm trying to build a C++ project with Boost and Cinder on Windows Server 2008 with MSBuild without success. I've build the same project on my Windows 7 machine under VS2013 and MSBuild, however on the server it is saying that it can't open a library by the name of "threadsafestatics.lib"
I've never heard of threadsafestatics.lib and my Google-foo hasn't brought me any luck finding anything about it online.
Is there a way to find out what part of my project is depending on this library?
Providing debug level output for the build process helped to work around the problem:
Tools->Options->Projects and Solutions->Build and Run->MSBuild project build output verbosity
threadsafestatics.lib is a new library from the November 2013 CTP. If you are compiling with the CTP, you must add its installed lib folder to Project > Properties > VC++ Directories > Library Directories.
If you installed the CTP to its default location on a 64-bit machine, the path is C:\Program Files (x86)\Microsoft Visual C++ Compiler Nov 2013 CTP\lib
You can also use the macros $(VC_CTP_Nov2013_LibraryPath_x86), $(VC_CTP_Nov2013_LibraryPath_x64), or $(VC_CTP_Nov2013_LibraryPath_ARM) depending on your target architecture.
If you had installed "CompilerCTP.Nov2013"Patch package, and using toolset of ctp2013,you can try to change toolset into 2013 with the following steps:
project -> property ->config property -> platform toolset ->Visual Studio 2013 (v120).

How can I generate a Visual Studio 2012 project targeting Windows XP with CMake?

With Visual Studio 2012 Update 1 released, I am hoping to build a C++ project to support Windows XP. Is there a way to use CMake to generate a project that targets Windows XP? Basically CMake would need to generate a project file that uses Platform Toolset = Visual Studio 2012 - Windows XP (v110_xp).
According to http://www.cmake.org/Bug/view.php?id=10722 the answer is now (soon) yes.
Fixed in Version CMake 2.8.11
A new "generator toolset" feature has been added here:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dab9977 [^]
One may now run CMake from the command line with
-G "Visual Studio 10" -T "v90"
in order to build with a specific toolset. We've not yet added a
first-class interface to cmake-gui for this, but one may add the cache
entry "CMAKE_GENERATOR_TOOLSET" to contain the "-T" value before
configuring.
According to http://www.cmake.org/Bug/view.php?id=10722 the answer is no yes.
Update: The bug mentioned above has been resolved with the following comment:
Fixed in Version CMake 2.8.11
A new "generator toolset" feature has been added here:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dab9977 [^]
One may now run CMake from the command line with
-G "Visual Studio 10" -T "v90"
in order to build with a specific toolset. We've not yet added a
first-class interface to cmake-gui for this, but one may add the cache
entry "CMAKE_GENERATOR_TOOLSET" to contain the "-T" value before
configuring.
You might also look at the comments made to the other answers.
I think you can just generate a Solution for Visual Studio 2010/2012. Open this solution, open the solution/project in visual Studio, open the properties and reconfigure the Platform toolset to v110_xp.
Then you should be fine. But I'm still searching for the solution how to setupo the command line to build v110_xp programs...
I think the best way to address this problem is use CMake to build your project for Visual Studio 2010 and then open the project with Visual Studio 2012. When you do this the toolset used will be vs2010, which works for WinXP.