why this problem always happened?

An error occurred while trying to generate project files.

Running C:/Program Files/Epic Games/UE_5.1/Engine/Build/BatchFiles/Build.bat -projectfiles -project=“C:/Users/Ari/Documents/Unreal Projects/MyProject3/MyProject3.uproject” -game -rocket -progress
Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” -projectfiles -project=“C:/Users/Ari/Documents/Unreal Projects/MyProject3/MyProject3.uproject” -game -rocket -progress
‘dotnet’ is not recognized as an internal or external command,
operable program or batch file.

Update visual studio and make sure you have installed all the necessary packages.

Looks like you’re missing some .NET stuff on yoru PC. Did you follow this?