MSB8008: Specified platform toolset <v120> is not installed or invalid error without installing VS2013 - c++

I am trying to build the C++ dlls with Msbuild from command prompt. But it was throwing the error as:
MS8008: Specified platform toolset is not installed or invalid.
I could see in some answers its been mentioned as issue will be resolved if VS2013 is installed in the machines, but Im trying to run in a build server where we shouldn't install visual studio. I have installed Microsoft Build Tools 2013 and 2015 even then the issue is resolved. Please help me if any configuration changes required or any other software's needs to be installed to build C++ dll with msbuild.

Related

Can I use vcpkg without Visual Studio?

I just downloaded and configured vcpkg. But when I tried to install a package, I got this error message:
error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance
Does it mean it is necessary to install Visual Studio to make the vcpkg available?
Considering that all my work is doing on clion and vscode, if it's necessary, what's the minimum required components should I install?
Or maybe it's just my wrong somewhere?
No, you do not need to install Visual Studio to use vcpkg. By default, vcpkg tries to build packages with the MSVC compiler if you are on Windows. You could install just the Visual Studio Build Tools, which would give you MSVC without installing the entire IDE, if you wish.
What compiler are you currently using?
If you happen to be using MinGW, you should tell vcpkg to use that. See: https://vcpkg.io/en/docs/users/mingw.html.
Disclaimer: I work on the vcpkg tool.

CMake: EWDK is detected as VS2022 with v143 toolset when only its actually VS2019 + v142

Evening,
I am trying to get a ci pipeline working for my cs class about windows driver.
For this I am using the Enterprise WDK which is a command line build environment that does not require any installation prior to use.
See: https://learn.microsoft.com/en-us/windows-hardware/drivers/develop/using-the-enterprise-wdk
When building the driver with msbuild from the EWDKthrough the solution file the build succeeds. On the other hand, when calling cmake it incorrectly detects EWDK as Building for: Visual Studio 17 2022 and therefore generates VCTargetsPath.vcxproj with <PlatformToolset>v143</PlatformToolset> although the EWDK is shipped with v142 and Visual Studio 2019.
When using the same CMakeList.txt with VS2019 Pro + WDK on my notebook cmake correctly detect everything correctly.
Is there any way to manually overwrite the Toolset or to point cmake in the right direction to choose the correct VS version?
Regards Artur

how to install vcpkg for vs code?

I tried to install vcpkg for VS code and in a PowerShell Window. I had this error:
Could not find MSBuild version with C ++ support. VS2015, VS2017 or VS2019 (with C ++) must be installed.
So I installed Visual studio and I have the same error. What should I do?
Run vcpkg integrate install to customize Visual Studio Code on Linux or macOS. This command sets the location of the vcpkg enum and enables IntelliSense for the source files.
Look at this web page: https://learn.microsoft.com/ru-ru/cpp/build/vcpkg?view=msvc-160#integrate-with-visual-studio-code-linuxmacos

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...

Application not running on a PC with VS 2008 not installed

I have been working on a project using OpenCV and have made a face detection project.
I would like to know why does an executable created using Visual Studio 2008 not run on another pc and give the following error:
"This application has failed to start because the application configuration is incorrect"
Perhaps you need the Visual C++ Runtime package installed.
Available for download .... here
You need to install Microsoft Visual C++ 2008 Redistributable Package on the machines you are deploying your application first - http://www.microsoft.com/download/en/details.aspx?id=29
The Microsoft Visual C++ 2008 Redistributable Package (x86) installs
runtime components of Visual C++ Libraries required to run
applications developed with Visual C++ on a computer that does not
have Visual C++ 2008 installed.
Another thing to note is you will have to take the binary from Release build (not Debug.) The Debug build wouldn't run on the deployment machine even if the VC++ Runtime is installed.