Cannot Create C++ Project

I’ve been trying to make a C++ project for over a month now. I’ve gotten numerous errors, and every time I fix one I just get a different one instead. I’ve had it give a System.OutOfMemory exception partway through generating the project files which then caused a failure to compile error whenever I tried to open it in the Unreal Editor, I’ve had it say that modules were missing, and now it’s giving me this:

An error occurred while trying to generate project files.

Running C:/Program Files/Epic Games/UE_5.0/Engine/Binaries/DotNET/UnrealBuildTool/UnrealBuildTool.exe -projectfiles -project=“C:/Users/bobb1/Documents/Unreal Projects/StealthTest/StealthTest.uproject” -game -rocket -progress
It was not possible to find any compatible framework version
The framework ‘Microsoft.NETCore.App’, version ‘3.1.0’ was not found.

  • No frameworks were found.

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:

I went to the link and installed it, but I’m still getting the same error. I’ve tried installing a bunch of different versions of the NETCore SDK, but nothing has worked. I’m using Unreal Engine 5.0.3 and I use Rider as my IDE since I couldn’t get Visual Studio to work.

Don’t use UE5.0.3, use 5.1 instead, it’s less bugged and several things changed in these few months.

You need to have visual studio installed even if you use Rider, otherwise it won’t work

The reason I switched to 5.0.3 is because 5.1 kept giving me a System.OutOfMemory exception when I tried to make a C++ project and a post on here said that it was a common error in 5.1 that didn’t happen in 5.0.3. I do have Visual Studio installed, and when I right click on the .uproject file (I already have a couple of projects I’ve been working on) to switch the engine version to 5.1, I get this error:

Failed to load the dll from [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\6.0.13\hostpolicy.dll], HRESULT: 0x800700C1
An error occurred while loading required library hostpolicy.dll from [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\6.0.13]

Usually the problem is caused by missing .Net modules, these are mine:

In Workloads you need to install at least these modules:

I have 15.8 GB of usable RAM, and I have VS 2022.

Yeah, I made sure all of those were checked. A few of them weren’t previously, but checking them didn’t fix the issue. I did previously uninstall one of the .NET versions using Add or Remove Programs. Maybe that’s it?

The same errors I was getting before.

I installed everything on my laptop just to see if it would work there so I could figure out if maybe something on my Desktop is causing the issue, but trying to make a C++ project on my laptop in 5.1, I get this error.

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/bobb1/OneDrive/Documents/Unreal Projects/MyProject/MyProject.uproject” -game -rocket -progress

Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” -projectfiles -project=“C:/Users/bobb1/OneDrive/Documents/Unreal Projects/MyProject/MyProject.uproject” -game -rocket -progress

‘dotnet’ is not recognized as an internal or external command,

operable program or batch file.

I had already done that before I got the error.

I only have 2022. I think the core of my problem is that it can’t find .NET 3.1.0 even though I have several versions of 3.1. I couldn’t find any labelled specifically as 3.1.0 online.

Did you restart after the install of 3.1?

Yes.

I checked that, and it’s there. A Windows help article said to move that above the Program Files(x86)\dotnet, which I did, but it didn’t help.

Uninstalling and reinstalling everything involved, including all .NET programs, seems to have narrowed down the issue to it failing to load the hostfxr.dll. The weird thing is, on rare occasions it successfully loads it and everything works properly, but most of the time it doesn’t. Here’s the error message again:

Running C:/Program Files/Epic Games/UE_5.1/Engine/Build/BatchFiles/Build.bat -projectfiles -project=“C:/Users/bobb1/Documents/Unreal Projects/ShadowcatsPrototype/ShadowcatsPrototype.uproject” -game -rocket -progress -log=“C:\Users\bobb1\Documents\Unreal Projects\ShadowcatsPrototype/Saved/Logs/UnrealVersionSelector-2023.02.04-12.43.08.log”
Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” -projectfiles -project=“C:/Users/bobb1/Documents/Unreal Projects/ShadowcatsPrototype/ShadowcatsPrototype.uproject” -game -rocket -progress -log=“C:\Users\bobb1\Documents\Unreal Projects\ShadowcatsPrototype/Saved/Logs/UnrealVersionSelector-2023.02.04-12.43.08.log”
Failed to load the dll from [C:\Program Files (x86)\dotnet\host\fxr\7.0.2\hostfxr.dll], HRESULT: 0x800700C1
The library hostfxr.dll was found, but loading it from C:\Program Files (x86)\dotnet\host\fxr\7.0.2\hostfxr.dll failed

I’m not sure which prerequisites I would be missing. I’m on Windows 10.

Here’s what I’ve got installed.

VS 2022, Windows 10

Setting Up Visual Studio Development Environment for C++ Projects in Unreal Engine | Unreal Engine 5.1 Documentation

Works for me

After reinstalling everything and deleting and recreating the project, everything works fine. There’s just one more relatively small issue. The MappingContext generated as

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = “true”))
class UInputMappingContext* DefaultMappingContext;

which gives an error because it needs to be a UCLASS, USTRUCT, or UENUM instead of a UPROPERTY. Since I’m still just starting out, I don’t know what the correct syntax for the MappingContext looks like. Can anyone help?

EDIT: Scratch that, I was just missing the necessary include.