As I am trying to build something in visual studio then visual studio show me some warning and then If i ignored it and build then error occurs.
error MSB8020: The build tools for v142 (Platform Toolset = 'v142')
cannot be found. To build using the v142 build tools, please install
v142 build tools.
It will also show me an Alternate option I also tried it but not works.
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".
I had the same problem, but when trying to open a project made in VS2019 with VS2017, so I changed this in my project:
Go to: Project->Properties->General->Platform Toolset and change to the current version of your VS.