I also experienced this error message, though in the context of opening an Unreal 5.3 project pulled from source control.
The solution for me was adding the modules “Game development with C++” as well as “Desktop development with C++” for Visual Studio 2022. After installing only the first module and opening the project in Visual Studio I was prompted to install the second one.