Reputation: 809
Under "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC"
, I have different directories such as :
However, I noticed Visual Studio always uses the newest minor version.
Can I set it to use an older minor version of the toolset?
Upvotes: 3
Views: 3787
Reputation: 11
I used Timothy G.s suggestion (which worked - thank you!) and took it a step further.
I overwrote the VCToolsVersion and VCToolsRedistVersion in both the default AND base platform props/txt files in C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build
I still had selected v143 in the Platform Target Toolset in the C++ project properties (in visual studio - so no changes to project)
I took the VCToolsVersion and VCToolsRedistVersion info from this:
and overwrote the VCToolsVersion and VCToolsRedistVersion info in these files:
bingo bango, project builds perfectly.
This allowed me to build our legacy programs without making any changes to the project itself. Our company is forced to use out of date toolsets due to some other software we integrate with that isn't up to date... And many of our tools are used in that software...
Upvotes: 0
Reputation: 9027
You can at a solution level. Following this guide:
-Bv
as an "Additional Options" in the C/C++ → Command Line menu item. This will output the compiler version upon building.C:\Program Files (x86)\Microsoft Visual Studio\2019\<yourVisualStudioVersion>\VC\Auxiliary\Build
and find the minor version Build.x
folder of the minor version you wish to use and open it.Microsoft.VCToolsVersion.X.Y.props
file (where X is the major version and Y is the minor)<Import Project="$(SolutionDir)\Microsoft.VCToolsVersion.X.Y.props" />
just above the line that says <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
.This should allow you to build against a specific minor version of a major version toolset. The guide also has some other ways, one of which makes use CMake which may be more flexible once configured.
Upvotes: 7