Recompile of game code corrupts editor build

I am using UE4 from source.

I have upgraded from 4.19.2 to 4.22.0

Since the upgrade I have conflict when compiling game solution via Visual Studio (2017 or 2019).

When I compile game solution (Visual Studio) it triggers recompile of the UE4Editor project, which then causes this problem when opening .uproject

275159-error02.png

When UE4Editor.exe is launched directly this problem comes up:

275160-error01.png

Everything starts to work fine when I recompile Editor solution and open a .uproject - I can edit C++ code and compile from editor, but the same problems come up when game project is recompiled from Visual Studio game solution (which in turns causes UE4Editor project to recompile also).

I am at wits end on how to troubleshoot this. This was not happening in 4.19.2. Any ideas would be appreciated.

Just to update, for future reference.

The problem was that the editor would compile with different toolchain than Visual Studio would. 2017 vs 2019. Once that was resolved - the problem disappeared.

There is a helpful guide here that helped me resolve this eventually: