What is "Platform Toolset" setting in visual studio project - c++

I have three doubts. Anyone there for help?
What is the "Platform Toolset" project setting in VS project
Why such setting required
What happen, if I change the setting (v110 to v100)

It is an MSBuild property that controls the specific version of the platform toolset that you want to use.
More info here: http://msdn.microsoft.com/en-us/library/windows/hardware/hh454232%28v=vs.85%29.aspx
Most likely you want to use the last stable Windows SDK. You can check the toolset that you are using looking at your Visual Studio project file (.vcxproj), looking for this XML entry:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label="Configuration">
<ConfigurationType>Driver</ConfigurationType>
<DriverType>KMDF</DriverType>
<PlatformToolset>WindowsKernelModeDriver8.1</PlatformToolset>
</PropertyGroup>

Moreless it is a version of toolchain that is used to build your project. So depends on version you have selected, different compiler, linker (etc) versions are used. If you select toolset version that was released with VS2017 (v141), MSBuild will use tools from this toolset do build your project.
It is nicely described under link provided by: YoavKlein.
"The platform toolset consists of the C++ compiler (cl.exe) and linker (link.exe), along with the C/C++ standard libraries. Since Visual Studio 2015, the major version of the toolset has remained at 14, which means that projects compiled with Visual Studio 2019 or Visual Studio 2017 are ABI-backwards-compatible with projects compiled with Visual Studio 2015. The minor version has updated by 1 for each version since Visual Studio 2015:
Visual Studio 2015: v140
Visual Studio 2017: v141
Visual Studio 2019: v142"
So there is no difference in ABI if the major version is same (but in your case you ask about change from v110 to v100 so the compatibility may be broken), but it may happen that f.e. compiler provided with older version of toolset does not implement some features of the new or incomming c++ standard etc.

It is the version of all the tools used to compile and link your project.

The mapping between PlatformToolset and Visual Studio versions is as follows
Visual Studio 2012: v110
Visual Studio 2013: v120
Visual Studio 2015: v140
Visual Studio 2017: v141
Visual Studio 2019: v142
Visual Studio 2022: v143
(v130 was skipped)
Taken from
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/platform-toolset
https://learn.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=msvc-170
https://marcofoco.com/blog/2015/02/25/microsoft-visual-c-version-map/

In Visual Studio, in Solution Explorer, open the shortcut menu for your project (not for your solution) and then choose Properties to open your project Property Pages dialog box.
In the Property Pages dialog box, open the Configuration drop-down list and then select All Configurations.
In the left pane of the dialog box, expand Configuration Properties and then select General.
In the right pane, select Platform Toolset and then select the toolset you want from the drop-down list. For example, if you have installed the Visual Studio 2010 toolset, select Visual Studio 2010 (v100) to use it for your project.
Choose the OK button.

I Would refer to this link, i think it's explained better there:
https://learn.microsoft.com/en-us/cpp/build/how-to-modify-the-target-framework-and-platform-toolset?view=vs-2019

Related

Visual Studio Project 2019 project still require msvcr120d.dll

I migrate Visual Studio 2013 project to visual studio 2019 and recompiler my all dlls and other files using visual studio 2019. But when I run my application, it still requires msvcr120d.dll in release mode.
Anyone help me out to fix this.
Go to settings and select proper Platform Toolset
for vs2019 select v142

Compiling using MSBuild 12.0 from Microsoft Visual Studio 2015

I have a solution that was compiled with MSVC 12.0 Visual Studio 2013 (C++/CLI and C#) but only have Visual Studio 2015 (Community). I want to build the project using MSVC 12.0 as it was intended, as I only need to rebuild 1 part of the solution (of 5) for my purpose and want it to be compatible with the other DLLs. When trying to build it from MSVC 14.0 (Visual Studio 2015) it says:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(57,5): error MSB8020: The build tools for v120 (Platform Toolset = 'v120') cannot be found.
Of course I installed the MS Build tools for 2013 (MSVC 12.0, v120) from here: https://www.microsoft.com/en-us/download/details.aspx?id=40760 as well as the Microsoft Visual C++ Redistributable 2013 package.
And the right directory for the 12.0 build tools install is C:\Program Files (x86)\MSBuild\12.0\Bin\amd64
It looks like a configuration error on the solution (or in Visual Studio in general) since it is looking for the build tools in the wrong directory. Does anyone know what settings I need to change / add in Visual Studio to get it to compile with MSBuild 12.0 instead of 14.0? I'd prefer not to install Visual Studio 2013 since I don't use it for anything else (just want to have the option to use VS 2013 MSBUILD within VS 2015 as needed).
Okay I have gotten this working although in a roundabout way. Thanks others that have answered and commented. Sign up for a Microsoft Visual Studio Dev Essentials subscription for free. https://azure.microsoft.com/en-us/pricing/member-offers/vs-dev-essentials/ Then you can go through the menus and download Visual Studio Community 2013 by going to this link and finding it https://my.visualstudio.com/downloads. After doing so, you can build MSVC 12.0 from Visual Studio 2015. Sure, not perfect, but it works. I haven't tried uninstalling Visual Studio 2013 to see if it still works (Windows Phone SDK 8.1 is installed with 2013 as was mentioned to get it working in the Enterprise version of 2015) but if you could somehow keep that and remove the 2013 edition I believe it could work without 2013 installed...
If you go to the top of your .vcxproj change it to this
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Then your .sln can still open in Visual Studio 2015
VisualStudioVersion = 14.0.25420.1
The reason is because the compiler version is specified on a project-by-project basis, and will override the solution version.
I'd prefer not to install Visual Studio 2013 since I don't use it for anything else (just want to have the option to use VS 2013 MSBUILD within VS 2015 as needed).
You can install VS2013 toolset version from your VS2015 installer without installing visual studio 2013. From the 2015 installer, select Windows 8.1 and Windows Phone 8.0/8.1 Tools and common Tools for Visual C++ 2015:
After installation completed, you will find the platform Toolset below:
Then you can built your project with platform toolset Visual Studio 2013(v120).
You can refer to more info from the similar question on SO.

Visual Studio 2015: how to build ATL projects targeting Visual C++ v120

I am using Visual Studio 2015 Community Edition.
In VS2015 installer, selecting Common Tools and MFC Components under the Visual C++ node, I am able to build ATL based projects.
Selecting Tools and Windows SDKs, under Windows 8.1 and Windows Phone Tools node, I am able to build MFC projects based on Platform Toolset v120, that is Visual Studio 2013.
Now I would like to build an existing ATL project, relatively large, originally built in Visual Studio 2013.
When I set Platform Toolset = 'v120' in the ATL project, the compiler is unable to find the ATL headers.
Is it possible to install them?
Do I have to install both VS2013 and VS2015?
You do need to install the earlier version of Visual Studio if you want to use its compiler toolchain. You can also open a developer command prompt to select the compiler version and use msbuild to build the target using that specific compiler but you still need to have installed the compiler version you need.

Using v90 (VS2008) Platform Toolset in Visual Studio 2015

Is it possible (and how) to use VS2015 IDE to build native C++ projects using the compiler, linker, the STL and everything else that comes with VS2008?
What I'm trying to do is called "C++ Native Multi-Targeting" and is known that e.g. VS2012 allows usage of VS2008 (v90) toolset, for C++ projects, via Project Properties->Configuration Properties->General->Platform Toolset=v90. Normally, out-of-the-box v90 will not be available, but will appear if you make side-by-side installations of VS2008+VS2010+VS2012 or VS2008+win7.1sdk+VS2012.
But I couldn't find so far any reported attempts at bridging the bigger gap between vs2008 and vs2015 for C++ projects. According to MSDN it seems that officially it's not supported. But I'd like to know if it might work anyway.
for reference, platform toolset values are:
Visual Studio .NET 2002 (Platform Toolset = 'v70')
Visual Studio .NET 2003 (Platform Toolset = 'v71')
Visual Studio 2005 (Platform Toolset = 'v80')
Visual Studio 2008 (Platform Toolset = 'v90')
Visual Studio 2010 (Platform Toolset = 'v100')
Visual Studio 2012 (Platform Toolset = 'v110')
Visual Studio 2013 (Platform Toolset = 'v112')
Visual Studio 2015 (Platform Toolset = 'v114')
It should be possible. I have tried it but MSBuild fails with the following message:
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(57,5): error : Required file "" is missing.
The only solution I have found so far was to add the following line in vcxproj file:
<PropertyGroup Label="Globals">
...
<TrackFileAccess>false</TrackFileAccess>
</PropertyGroup>
Disadvantage: Always a complete build for every change

How to generate Visual Studio Solutions for Multi-targetting via CMake?

Visual Studio, as of VS2010, supports the concept of multi-targetting, where a solution can be configured for, and built with, the compiler, libraries and includes of preceding Visual Studio versions. For example, the 2010 IDE can be used to build with the v90 (2008) toolset; in 2012 IDE can be used to build with v90, v100, v110 and v110_xp toolchains, and so on.
The question is this; how to configure a CMake build system, already setup to generate solutions for Visual Studio N to build with the compiler etc of Visual Studio N, to permit building with Visual Studio N-M from within the IDE.
While toolset selection should work merely by -T toolset, the issue is that this then in turn provokes a failure in cmake-2.8/Modules/CMakeTestCXXCompiler.cmake , claiming that the cl.exe is not able to compile a simple program. This is not the case, however, in selecting a toolset within a Visual Studio version e.g. v110_xp in Visual Studio 2012. There seems to be some complication in toolsets across Visual Studio versions, as opposed to toolsets within Visual Studio versions.
Does anyone have concrete experience of CMake in this usecase, in generating solutions for toolsets from preceding versions for use in the IDE of the current version of Visual Studio?
That's covered by the CMake's command-line option -T (toolset selection), available since CMake 2.8.11. The syntax is simple:
cmake ... -T "the string VS uses to identify the toolset" ...
So, for example:
cmake ... -T v90 ...
Note that so far, this option does not have a dedicated widget in the GUI.