'How to build a visual studio 2019 project in vs 2022 without upgrading

Attempting to build a vs 2019 project in vs 2022 gives the following error:

Error MSB8020 The build tools for Visual Studio 2019 (Platform Toolset = 'v142') cannot be found. To build using the v142 build tools, please install Visual Studio 2019 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".

Solution

If I retarget I have to get everyone in my team to upgrade to vs 2022. Given the minimal improvements I will most likely end up just installing 2019.

I have installed something called "visual studio build tools 2019" (which I found after a lot of searching here https://visualstudio.microsoft.com/visual-cpp-build-tools/) as the error suggests but the error persists.

Edit, Solution: As mentioned by Carl Lambert below, there is a component that can be added in the VS Installer. I am adding a screenshot here to make it really easy to find for anyone else with this issue:

enter image description here



Solution 1:[1]

If you take a look at the available visual studios components (this is the link for professional https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-professional?view=vs-2022&preserve-view=true ).

I believe the component id you are looking for is: Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Carl Lambert