Generate cpp project Couldn't find UnrealBuildTool

As of 24-Mar-2022, with UE5 Preview 2 installed from the Epic Games launcher to a non-default location (D:\Dev\UE_5.0), this is still a problem.

I was able to fix this, see below for details.

To restate the issue: When trying to clean my project, I was getting an unhelpful error saying something about Error_UBTMissing. It was impossible to clean or rebuild from my code editor. (Using Rider early access in case it matters).

I tracked down the issue to a bug in Engine/Build/BatchFiles/Clean.bat

There is a line there that specifically affects installed builds of UE5 differently than compiled builds. Apparently its intent is to prevent the rebuilding of UE5 itself during the clean(?)

In any case, the goto ReadyToClean statement caused the set UBTPath=... to never be executed and so UBTPath was an undefined variable. Perhaps this is OK when UE5 is installed into the default location(?), but it definitely does NOT work if UE5 is installed to a custom location.

To fix the error, I simply moved this line:

set UBTPath="..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll"

above this line:

if exist ..\Build\InstalledBuild.txt goto ReadyToClean

After saving Engine/Build/BatchFiles/Clean.bat with the new appropriately assigned UBTPath variable, Clean and Rebuild are now working as expected.

2 Likes

indeed that solves it

I still wonder where the error message about “Error_UBTMissing” comes from. As if the buggy clean.bat script tried to execute Error_UBTMissing where it really is just a goto label.

My guess is that deeper in the build process there is a default value for UBTPath, the default install location. Wherever that is, that is what is creating the Error_UBTMissing error message which coincidentally (perhaps intentionally?) mirrors the name of the goto in Clean.bat.

Anyway, easy fix here, hopefully someone commits this before the next preview release, as currently it is 100% broken for non-default location installs, at the very least.

1 Like

I spend about half a day fighting this bug. This is of course also due to my lack of experience with UE. But once clean didn’t work anymore (without me noticing), my changes in that one cpp-file were not reflected in the engine anymore. Naturally, I didn’t realize that, either. Instead I added log statement of all kinds and got frustrated that no log would show up and so on and so forth. Thanks for that fix!

Another possibility: if you have this environment variable set on windows ( MSBuildSDKsPath
C:\Program Files\dotnet\sdk\3.1.201\Sdks ) , remove it, reboot.

I found my clean.bat mentioned by xi57 already correct, but running it… I got errors like mentioned here: MSB4018: The "GenerateDepsFile" task failed unexpectedly. · Issue #3376 · dotnet/sdk · GitHub
took the key out of the environment variables table and everything worked.

Struggling with this problem right now. the unreal build tool .exe doesn’t exist in my installation at all. I have searched and searched for it, even in the Epic Games folder under Programs. I too have installed this not on the C drive, so that is why I am suffering from these problems. I cannot run any of the commands listed in these posts because the exe simply isn’t there for me to run them off of. I also tried to look at the clean.bat file, but it is very short and didn’t have a PBT path as described.

This all occurred after I tried to add an Actor Interface C++ class from within Unreal Engine while I had errors in my code. When it tried to do Live Reload coding, the build failed obviously. Then I began to notice changes to my cpp files not updating when I ran things in Unreal. I cleaned the project and the solution and it was all messed up from that point forward. Can’t even get into my project any more.

I can’t rebuild the solution files either, as it relies upon the exe, which I am missing.

My only resort at this point is to create a new project.

Edit: I found “D:\UnrealEngine\UE_5.3\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.sln”, booted that up, built the project, and luckily it did make the exe that I was missing. I still can’t imagine why I wouldn’t have it to begin with because I just installed Unreal like a week ago. I ran one of the cmd commands from above posts, rebuilt the solution by right-clicking the project, rebuilt from within Visual Studio, and now am finally back to normal. Holy smokes this was a nightmare.

4 Likes

Just go to the Unreal engine folder, UE_5.3\Engine\Source\Programs\UnrealBuildTool and here can find the sln, build , and you can use again .

18 Likes

That did it for me, thanks!

4 Likes

Another possible solution is to verify the engine using the Epic Store app and redownload those files.
In my case, the missing UnrealBuildTool.* and related configs were downloaded and sln project generation began to work.

3 Likes

This is the final answer!!!

I was about to lose my sanity…
Thank you so much! Worked!

Mr life saver.

Fantastic. Opening the sln and building that allowed me to run the Generate Visual Studio Project files again. Thanks so much for the solution.

Thank you, TJYDSG! This did the trick!