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

**URL:** <https://forums.unrealengine.com/t/i-unable-to-compile-c-project-with-the-source-version-of-ue-5-1/719859>\
**Category:** Platform & Builds\
**Tags:** unreal-engine, build-failed\
**Created:** [December 2, 2022, 8:13am UTC](https://forums.unrealengine.com/t/i-unable-to-compile-c-project-with-the-source-version-of-ue-5-1/719859 "2022-12-02T08:13:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomza](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tomza](https://forums.unrealengine.com/u/Tomza)\
**Post date:** [December 2, 2022, 8:13am UTC](https://forums.unrealengine.com/t/i-unable-to-compile-c-project-with-the-source-version-of-ue-5-1/719859/1 "2022-12-02T08:13:22Z")

</div>

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](http://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]

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/1/6/e16c37f5b96d70db504bfb31e571a2f72b323b8a.jpeg)

---

<div class="post-metadata">

**Author:** ![Cthutu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cthutu](https://forums.unrealengine.com/u/Cthutu)\
**Post date:** [January 5, 2023, 11:21am UTC](https://forums.unrealengine.com/t/i-unable-to-compile-c-project-with-the-source-version-of-ue-5-1/719859/2 "2023-01-05T11:21:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nteymory](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nteymory](https://forums.unrealengine.com/u/nteymory)\
**Post date:** [January 6, 2023, 12:14am UTC](https://forums.unrealengine.com/t/i-unable-to-compile-c-project-with-the-source-version-of-ue-5-1/719859/3 "2023-01-06T00:14:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![artem\_blanche](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artem\_blanche](https://forums.unrealengine.com/u/artem_blanche)\
**Post date:** [January 25, 2023, 12:49pm UTC](https://forums.unrealengine.com/t/i-unable-to-compile-c-project-with-the-source-version-of-ue-5-1/719859/4 "2023-01-25T12:49:25Z")

</div>

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![artem\_blanche](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@artem\_blanche](https://forums.unrealengine.com/u/artem_blanche)\
**Post date:** [January 26, 2023, 10:41am UTC](https://forums.unrealengine.com/t/i-unable-to-compile-c-project-with-the-source-version-of-ue-5-1/719859/5 "2023-01-26T10:41:26Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/c/f/fcf9b22ebd2fc2884c4b654a59503c4b7bc5f8f7.png)

---

<div class="post-metadata">

**Author:** ![asdlkjqpwoei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@asdlkjqpwoei](https://forums.unrealengine.com/u/asdlkjqpwoei)\
**Post date:** [February 9, 2023, 3:50pm UTC](https://forums.unrealengine.com/t/i-unable-to-compile-c-project-with-the-source-version-of-ue-5-1/719859/6 "2023-02-09T15:50:50Z")

</div>

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