Building C++ project in 5.1 gives: Failed to create CoreCLR, HRESULT: 0x80004005

Hello! does anybody encountered this Failed to create CoreCLR, HRESULT: 0x80004005 while building a C++ project?

It works perfectly in 5.0, but whenever I switch to 5.1, I can’t even create any / generate(by using the right-click generate visual studio files) any C++ projects.

This error wouldn’t occur when I create a blueprint project, the project creates successfully. Thus I suspect it as a dotnet problem not an unreal problem…
I tried reinstalling SDKs & Runtimes of dotnet, validated unreal engine 5.1, but with no success.
I have searched online and I’m still confused what I should do, as I don’t see much people having this problem in the first place.

For some background, I have Visual Studio Community 2022, this problem occurred only in 5.1, but not in 5.0 of unreal, I followed the steps in Setting Up Visual Studio Development Environment for C++ Projects in Unreal Engine | Unreal Engine 5.1 Documentation, make sure that my installed components are correct, unsurprisingly it still didn’t work.

Been having this problem for days, any help is really appreciated! Thanks!

1 Like

I’ve investigated further and have suspected because of my installation part, I recall having the problem Path too long error also when I’ve installed the engine version 5.1, but not on 5.0(which is the engine version that works perfectly)…

Did the Unreal Header Tool some how called dotnet with incomplete paths as it’s too long?

I have found a solution! I uninstalled every single .NET SDKs (including runtimes) from the visual studio installer (the individual components tab) and also the in the required workspaces.

Then it prompted me with this message when I create a new C++ project:

So then what I naturally did is, I go back into visual studio installer, reinstalled the required components in the workspaces.

Tried it again and it worked!

For anyone else who also encountered this problem, my problem was because my .NET 6.0 Runtime isn’t installed properly, so what I did is:

  1. Open Visual Studio Installer, and select modify (I’m using Visual studio 2022)

  2. Proceed to the Workloads tab, remove all the check marks shown in the tutorial picture here

  3. and after removing everything, go to your system’s settings’ programs and features, and check if there are some remaining .NET stuff, take a picture(just incase you need to reinstall some of the other ones), and delete all of it

  4. finally go back to the Workloads tab and tick those on again, and wait for it to reinstall, and voila! you should be able to create / build C++ projects again!

Hope this will help anyone in confusion!