Description

This is a race condition caused by how "Clean.bat", a batch file used during rebuilds, tries to manually rebuild the UnrealBuildTool project when it runs. This causes a spam of UnrealBuildTool builds, and once in a while this causes a sharing violation on the files mentioned above. It is believed that Clean.bat needs to be rewritten to accept UnrealBuildTool as a properly built dependency, and not try to build UnrealBuildTool as a side effect.

Steps to Reproduce

1) Pull the 4.23 UE4 engine source onto your local machine (with git, not Epic Launcher)
2) Generate the Visual Studio project files to build the UE4 engine source.
3) Open the UE4.sln in Visual Studio, I use VS 19 for Windows.
4) In Visual Studio, select "Clean Solution" from the menu bar.
5) Now select "Rebuild Solution".
6) Near the very beginning of the build you may see warnings about certain files in the DotNETCommon folder not being accessible because they are in use by another process. You may see a fatal error on "\Engine\Source\Programs\DotNETCommon\DotNETUtilities\obj\Development\DotNETUtilities.csproj.FileListAbsolute.txt" rarely, a similar sharing violation that breaks the build. If you don't see these errors, Clean Solution again and Rebuild Solution again. The warnings are common, the fatal error is maybe 1/10 repro for me. The Clean is important since it affects the timing of the build.

Results: Error MSB3491 Could not write lines to file "obj\Development\DotNETUtilities.csproj.FileListAbsolute.txt". The process cannot access the file 'D:\Source Versions\UnrealEngine-4.23.0-release\Engine\Source\Programs\DotNETCommon\DotNETUtilities\obj\Development\DotNETUtilities.csproj.FileListAbsolute.txt' because it is being used by another process. [D:\Source Versions\UnrealEngine-4.23.0-release\Engine\Source\Programs\DotNETCommon\DotNETUtilities\DotNETUtilities.csproj] UnrealFileServer C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 5106

Expected: The UE4 engine source to build without error.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-80867 in the post.

1
Login to Vote

Won't Fix
CreatedSep 26, 2019
ResolvedAug 27, 2021
UpdatedAug 27, 2021