I unable to compile C++ project with the source version of UE 5.1

Hello,

I have the UE 5.1 (not binary, but source), and I try to compile it with a project. I use Perforce. After having updated project to UE 5.1, I am unable to compile with the following errors:

26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: The “GenerateDepsFile” task failed unexpectedly. [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: System.IO.IOException: The process cannot access the file ‘D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\bin\Development\netcoreapp3.1\EpicGames.Core.deps.json’ because it is being used by another process. [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at System.IO.File.Create(String path, Int32 bufferSize) [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateDepsFile.WriteDepsFile(String depsFilePath) [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateDepsFile.ExecuteCore() [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskWithAssemblyResolveHooks.Execute() [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]
26>D:\Perforce\MyPC\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(176,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() [D:\Perforce\MyPC\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj]

1 Like

I get exactly this too. Did you find a solution to it?

Also getting the same problem. If you try rebuilding a couple times, it will eventually succeed. Annoying nonetheless

Hi there,

Did any of you find out what the issue is?

I am getting the same error, wondering if its about the .NET SDK and .NET Runtime versions

Error MSB4018 The "GenerateDepsFile" task failed unexpectedly. 
[C:\mlf\unreal-engine-source-5.1\UnrealEngine\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj] Unsync C:\mlf\unreal-engine-source-5.1\UnrealEngine\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets

Error MSB4018 System.IO.IOException: The process cannot access the file C:\mlf\unreal-engine-source-5.1\UnrealEngine\Engine\Source\Programs\Shared\EpicGames.Core\bin\Development\netcoreapp3.1\EpicGames.Core.deps.json because it is being used by another process. [C:\mlf\unreal-engine-source-5.1\UnrealEngine\Engine\Source\Programs\Shared\EpicGames.Core\EpicGames.Core.csproj] Unsync C:\mlf\unreal-engine-source-5.1\UnrealEngine\Engine\Binaries\ThirdParty\DotNet\6.0.302\windows\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets

In case this helps anyone, my project finally built successfully after doing these two things

  1. Generated the files specifically for VS 2022 by running GenerateProjectFiles.bat -2022

  2. Since I was creating a Dedicated Server for my project I also built both the Development Editor and Development Server by right clicking on the project in the Solution Explorer rather than using the toolbar ‘build’ menu
    image

Update your local repository from source and try again. Latest release fixed the problem. https://github.com/EpicGames/UnrealEngine/commit/5a761d5e44c535cdd6069bb99c786f02c7abe33b .