How to set the Visual Studio version?

There is no need to compile the editor just to change the compiler setting. In your project directory update the following files:

File: Config/DefaultEngine.ini

[/Script/WindowsTargetPlatform.WindowsTargetSettings]
Compiler=VisualStudio2019

File: Config/DefaultEditorPerProjectUserSettings.ini

[/Script/SourceCodeAccess.SourceCodeAccessSettings]
PreferredAccessor=VisualStudio2019

That should let you compile with your chosen version of visual studio instead of doing it twice.