I have a simple c++ console application in VS2019 that was working and running when the latest Windows Update decided to (helpfully?) restart the machine. Nothing in the application or its project settings changed and nothing else was installed or modified in any way (by me). On re-opening VS2019 my project fails to build with the following error
Severity Code Description Project File Line Suppression State
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. 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". ConsoleApplication1 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets 57
I have tried selecting all of the available SDK options from the retarget solution menu (there are four) and each time doing a clean and rebuild but but each time still fails.
So it seems like Windows has gone and replaced the SDK underneath? Do I need to install something new to get this working? I know I could probably get away with just creating a new project (and probably will this time), but I wouldn't want to do that with every forced update.
In case any of this helps, the application VC++ Directories setting does have
$(VC_IncludePath)
$(WindowsSDK_IncludePath)
Which before retargeting evaluated to
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\atlmfc\include
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\VS\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0\ucrt
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um
and after retargeting evaluated to (for example)
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\atlmfc\include
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\VS\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um