J.R.
J.R.

Reputation: 809

Make Visual Studio use different minor version Toolset?

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

Answers (2)

iduck
iduck

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:

VCToolsVersion and VCToolsRedistVersion info

and overwrote the VCToolsVersion and VCToolsRedistVersion info in these files:

files to modify

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

Timothy G.
Timothy G.

Reputation: 9027

You can at a solution level. Following this guide:

  1. Download whatever minor versions you need/want.
  2. Optionally, go to your projects properties and add -Bv as an "Additional Options" in the C/C++ → Command Line menu item. This will output the compiler version upon building.
  3. Go to 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.
  4. Copy the Microsoft.VCToolsVersion.X.Y.props file (where X is the major version and Y is the minor)
  5. Paste the file into the directory that contains the solution file for your solution.
  6. In Visual Studio, unload your project.
  7. Edit the .vcxproj file of your project and add <Import Project="$(SolutionDir)\Microsoft.VCToolsVersion.X.Y.props" /> just above the line that says <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />.
  8. Reload your project, and perform a test build. If done right, it should be using the minor version specified, which you can see in the output:

Output

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

Related Questions