UE5: Trying to build project in VS nukes "UnrealHeaderTool" and then complains about it missing, corrupting the engine install

After performing a clean install of UE5, I can create and launch projects without any issues. However as soon I try building a project in Visual Studio 2022, it gives me following error:

“Unhandled exception: System.IO.FileNotFoundException: Could not find file ‘D:\Unreal Engine\UE_5.0\Engine\Binaries\Win64\UnrealHeaderTool.target’.”

The weird thing is that the missing files are present upon clean install, and vanish before my eyes from the folder as soon I try building in VS, resulting in error and corruption of the engine install so I can no longer launch or create projects, forcing me to re-install or verify the engine.

Any idea what is going on?

3 Likes

I would add the /UnrealEngine/ directory to exclusions on Windows Defender…
I also do the same with my project folders.

Then remove system user rights to delete the files, just to be sure.

I had this issue today as well. For me, it was installing the Substance plugin from the launcher. Interestingly, adding the plugin manually to a project instead of the engine doesn’t cause any issues for me. I have also seen a similar post where someone had issues with the Discord plugin.

The “UnrealHeaderTool.target” file have so far been removed twice for me…

I also seems to lose some folders and files in "UE_5.0\Engine\Intermediate".
Like in “UE_5.0\Engine\Intermediate\Build\Win64\UnrealEditor\Inc” I have multiple times lost the first 69 folders, Engine is the first folder.

It seems to happen sometime when I use Rebuild “Project”.

Thanks all for the suggestions! Looking further into it, it seems that the problem isn’t limited to UnrealHeaderTool, the engine binaries Win64 folder is 18GB before running build and 2GB after, and the plugins folder went from 53GB to 21GB, so building any project in Visual Studio nukes many of files in there.

Moving Substance plugin to the project folder instead of engine’s did not help, neither did denying SYSTEM delete permissions or adding them to firewall exception, files still got deleted.

However, I just realised that I’ve been running “rebuild solution” in VS instead of “build ProjectName”, which is what was nuking the engine as I guess it attempted to rebuild it and failed? Running “build ProjectName” instead solved the issue.

Although it’s weird, since I was using “rebuild solution” before in Unreal 4 without issues.

2 Likes

Same with me. I had to repair the Engine and it redownload 11.5 GB.

It also happens when you use some IDE features like rename and refactor.

2 Likes

Same here. Hope we get a fix soon.

Happy/sad to see it’s not just a problem on my end. I was just trying to troubleshoot an unrelated issue where the launcher no longer sees my network drive (vault cache location)… I really didn’t need this piling on.

Hi,

I have the same issue with UE5 and Visual Studio 2022. I had to reinstall entire engine twice, repaired it twice and the problem persists. Also some of the UE5 plugins from the Market Place will not install, even if they are compatible with UE5.

After the unsuccessful Build (not rebuild) Unreal Engine will no longer start, it shows the following error message:
image

Kind regards

This happened to me after I right clicked my project and selected Clean.

We’re having this issue over and over too and can confirm the workaround is to “Never Clean or Rebuild - Only Build”

1 Like

Tossing my hat into this pile. I’m having the same issue, though I’m using the latest Rider for Unreal Engine.

Same problem here, I reinstalled VS 2022 and UE5, twice, but problem persist.

Same. Vs2019/UE5.

Same to me, asking continously to repair.
VS 19 and VS 22 + UE5.0
Formatted PC didn’t fix, now it’s presenting again on fresh installation.
In addition I cannot compile directly “UnrealHeaderTool” error via VS 19 and VS22, if I try on desktop command the error is: " Engine Modules are out of date, and cannot be compiled while the engine is running. Please rebuild through your IDE "

Same problem for me.

I have the same problem. Vs2019/UE5.

same here: UE5, VS2022. rebuild or clean deletes stuff from the engine folders and i need to repair the UE5 installation

1 Like

So I’m not alone… I thought I was mad, it’s the third time I repair the engine installation :sweat_smile:

Same happens to me. It happened in both VS2022 and Rider.

Edit: This only happens when I select Build/Clean Solution or Build/Rebuild Solution. If I only select run, then rider will build ok.