Unable to generate the project files

I am trying to build the engine from the source (release 5.3.1) and I am getting this error:

D:\UnrealEngine-release>GenerateProjectFiles.bat
Setting up Unreal Engine project files...
Using bundled DotNet SDK version: 6.0.302
The system cannot find the file specified.
File Not Found
Building UnrealBuildTool...
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1009: Project file does not exist.
Switch: Programs\UnrealBuildTool\UnrealBuildTool.csproj

RunUBT ERROR: UnrealBuildTool failed to compile.


GenerateProjectFiles ERROR: UnrealBuildTool failed to compile.

My dotnet version is:

D:\UnrealEngine-release>dotnet --version
7.0.403

have you ran setup.bat before generateprojectfiles.bat?

Yes, I ran it even twice.
No error was reported.

Never mind. Problem solved. I think a reboot helped.