Generate cpp project Couldn't find UnrealBuildTool

Thanks it works for my needs.

regenprojects.cmd

@echo off
SET PATH=%PATH%;D:\EpicGames\UE_5.0EA\Engine\Binaries\Win64;D:\EpicGames\UE_5.0EA\Engine\Binaries\DotNET;D:\EpicGames\UE_5.0EA\Engine\Binaries\DotNET\UnrealBuildTool;D:\EpicGames\UE_5.0EA\Engine\Binaries\DotNET\AutomationTool

UnrealBuildTool.exe -projectfiles -project=“D:\EpicGames\Myproject\MyprojectGame\MyprojectGame.uproject” -game -Engine -rocket -progress

Tons of errors trying to make my project work.
I’m no Visual studio/NuGet expert in any way but got the project created as per instructions mentioned in this thread.

Next issue is to get it to actually compile. Any idea what to do about this?

Error occurred while restoring NuGet packages: Access to the path ‘C:\Program Files\Epic Games\UE_5.0EA\Engine\Source\Programs\Shared\EpicGames.Jupiter\obj\EpicGames.Jupiter.csproj.nuget.g.props’ is denied.

I got same errors when trying to build from .sln created via command line like in previous suggestions, only way that worked was by opening project from launcher and converting there (but I also had to eliminate all compile errors before that worked so it took few tries by copying project over and over and fixing issues one by one)

This worked for me:
Delete your .sln file.
Open the project in the Unreal 5 editor and then select the ‘Refresh Visual Studio Project’ option under the Tools menu at the top.

1 Like

Replace the UnrealVersionSelector.exe in Launcher folder use the soure code compiled version.

@Maethor

delete Intermediate folder and remove -Engine from the command.

1 Like

This worked for me. Thanks

Thanks! That helped me a bit further.

The next step for me was to open C:\Program Files\Epic Games\UE_5.0EA\Engine\Build\BatchFiles\Build.bat in notepad and write REM before the line "REM call “%~dp0GetDotnetPath.bat” ", as that didn’t exist for me.

After this I struggled with some other preprocessor issues (where I just had to read the output and fix it), and am now to a bunch of project “errors”. So at least now it’s up to me to fix it (I hope).

Launching the game created new binaries and solved my problem

Updated to EA2, restarted Windows, and refreshed my C++ project using “Tools > Refresh Visual Studio Project” menu option in the Editor.

2> 'Error_UBTMissing' is not recognized as an internal or external command, operable program or batch file.
2> '"C:\Program Files\Epic Games\UE_5.0EA\Engine\Build\BatchFiles\GetDotnetPath.bat"' is not recognized as an internal or external command, operable program or batch file.

So, the issue remains the same (at least for me) even after EA2 update… :thinking:

1 Like

I’ve not tried with a project created with EA1 under EA2, but when using a new project created with EA2, both tools->Refresh Visual Studio Project and right-click .uproject in explorer and “Generate Visual Studio Project Files” both work successfully after adding new source files.

1 Like

@splodginald Thank you! After reading your post, I created a new EA2 C++ project using the Third Person template just for test purpose, and refreshed the project as you said. I am afraid it doesn’t work for me. Still getting the same errors as before. :frowning_face:

I’ve just tested again with a new project using Third Person template and it works fine for me.
I added code for a plugin, selected “Generate Visual Studio project files” in explorer, no errors displayed and everything built fine.
I can’t think what to suggest, but I hope you get it sorted.

Edit: I just repeated the process using “Tools > Refresh Visual Studio Project” menu option in the Editor and that worked fine for me too.

Copy Launcher\Engine\Binaries\Win64\UnrealVersionSelector.exe to UE_5.0EA\Engine\Binaries\Win64 and run it, registry directory. Then right click your uproject, reselect version and generate project. It is worked for me.

All you have to do is install .NET 3.1 Framework.
You can get it officially from Microsoft at Download .NET Core 3.1 (Linux, macOS, and Windows)

1 Like

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.