I have both Visual Studio 2019 and 2022 installed.
Building engine from source, UnrealBuildTool selected MSVC Toolchain 14.29.30133 (the latest that comes with 2019) and built fine.
When attempting to generate project files for a project (which is associated with this source engine build), I get the following error:
ERROR: UnrealBuildTool has banned the MSVC 14.32.31326-14.32.31328 toolchains due to compiler issues. Please install a different toolchain from the Visual Studio installer.
Why does UnrealBuildTool try to use a different toolchain than the engine when generating project files?
According to this:
CompilerVersion can be specified in build config, which is empty in my case, so I would assume it picks it up automatically.