Unreal Engine cannot make C++ games

I am new to Unreal and for some reason I can only create blueprint games. Whenever I try to make a C++ game, this happens:

Running C:/Program Files/Epic Games/UE_5.0/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe -projectfiles -project=“C:/Users/aaron/Documents/Unreal Projects/Scripting/Scripting.uproject” -game -rocket -progress
A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\DotNET\UnrealBuildTool].
If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].

The .NET Core runtime can be found at:

I don’t know why this is and I need help to fix it. Thank you!

Open Epic Games and try to verify the bugged UE installation… maybe this works

Download and install: .NET Core 3.1 SDK x64

I installed it, but now there is a new error message:

Running C:/Program Files/Epic Games/UE_5.0/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe -projectfiles -project=“C:/Users/aaron/Documents/Unreal Projects/Scripting/Scripting.uproject” -game -rocket -progress
Log file: C:\Users\aaron\AppData\Local\UnrealBuildTool\Log_GPF.txt

Some Platforms were skipped due to invalid SDK setup: IOS, Android, Linux, LinuxArm64, TVOS.
See the log file for detailed information

Discovering modules, targets and source code for project…
ERROR: Could not find NetFxSDK install dir; this will prevent SwarmInterface from installing. Install a version of .NET Framework SDK at 4.6.0 or higher.

Just realized something. Have you installed Visual Studio?

If not. I suggest having a look at this documentation and following the installation steps:

(For UE4, but still relevant to UE5)

Thank you, this worked! I had visual studio but not in the correct directory

I also have the same problem. The log says “Error while enumerating Visual Studio toolchains”, but i want to use ue5 with rider and i have already set the code editor to rider in settings. How can i fix it?

So here’s what happened to me, because Unreal seems to shows that it already supports Visual Studio 2022 based on the source editor dropdown, I picked that and set it as the default for the it. But that seems to be a lie. Because I thought I would just be needing VS Community 2022 after that change, I uninstalled all my other Visual Studio. But Unreal doesn’t like that. Right now with UE5, it seems to only know how to work with VS 2019, which was mentioned in here (Setting Up Visual Studio for Unreal Engine | Unreal Engine Documentation). After the sad realization, I reinstalled VS 2019 and I can confirm that you really need a .NET Framework for Unreal to recognize your VS 2019. I’m not completely sure if you really need the Desktop development with C++ and UWP development, but you can skip that and UE would still recognize VS 2019. Afterwards, VS would give a warning that you might be missing some dependency(?) and clicking that warning would open Visual Studio Installer asking if you want to install those stuff.