Access Denied error when building C++ project

Getting the below Access Denied error when trying to compile a basic C++ project from VSCode.
I’m using Unreal Engine 5.0.3 on Windows 7.
UE5 was installed from the Epic Games Launcher.

 *  Executing task in folder ObstacleAssault: Engine\Build\BatchFiles\Build.bat ObstacleAssaultEditor Win64 Development 'D:\Development Projects\Udemy UE5\Unreal Engine 5 CPP Developer\ObstacleAssault\ObstacleAssault.uproject' -waitmutex 

Using bundled DotNet SDK
Log file: C:\Users\Jake\AppData\Local\UnrealBuildTool\Log.txt
Building ObstacleAssaultEditor...
Using Visual Studio 2022 14.35.32216 toolchain (D:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215) and Windows
10.0.22621.0 SDK (D:\Program Files\Windows Kits\10).
[Adaptive Build] Excluded from ObstacleAssault unity file: MovingPlatform.cpp, ObstacleAssault.cpp
Determining max actions to execute in parallel (4 physical cores, 8 logical cores)
  Executing up to 4 processes, one per physical core
Building 9 actions with 4 processes...
ERROR: System.ComponentModel.Win32Exception (5): Access is denied.
          at EpicGames.Core.ManagedProcess.CreateManagedProcessWin32(ManagedProcessGroup Group, String FileName, String CommandLine, String WorkingDirectory, IReadOnlyDictionary`2 Environment, ProcessPriorityClass Priority, ManagedProcessFlags ManagedFlags) in d:\build\++UE5\Sync\Engine\Source\Programs\Shared\EpicGames.Core\ManagedProcess.cs:line 657
          at EpicGames.Core.ManagedProcess..ctor(ManagedProcessGroup Group, String FileName, String CommandLine, String WorkingDirectory, IReadOnlyDictionary`2 Environment, ProcessPriorityClass Priority, ManagedProcessFlags Flags) in d:\build\++UE5\Sync\Engine\Source\Programs\Shared\EpicGames.Core\ManagedProcess.cs:line 476
          at EpicGames.Core.ManagedProcess..ctor(ManagedProcessGroup Group, String FileName, String CommandLine, String WorkingDirectory, IReadOnlyDictionary`2 Environment, Byte[] Input, ProcessPriorityClass Priority, ManagedProcessFlags Flags) in d:\build\++UE5\Sync\Engine\Source\Programs\Shared\EpicGames.Core\ManagedProcess.cs:line 452
          at UnrealBuildTool.ParallelExecutor.ExecuteAction(ManagedProcessGroup ProcessGroup, BuildAction Action, List`1 CompletedActions, AutoResetEvent CompletedEvent) in d:\build\++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\Executors\ParallelExecutor.cs:line 402
       while launching D:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\cl.exe @"D:\Development Projects\Udemy UE5\Unreal Engine 5 CPP Developer\ObstacleAssault\Intermediate\Build\Win64\ObstacleAssaultEditor\Development\Engine\SharedPCH.Engine.ShadowErrors.h.obj.response"
[1/9] Compile SharedPCH.Engine.ShadowErrors.cpp
[1/9]Compile SharedPCH.Engine.ShadowErrors.cpp - Error but no output
[1/9]Compile SharedPCH.Engine.ShadowErrors.cpp - 1 D:\Full Games\Epic Games\UE_5.0\Engine\Source D:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\cl.exe @"D:\Development Projects\Udemy UE5\Unreal Engine 5 CPP Developer\ObstacleAssault\Intermediate\Build\Win64\ObstacleAssaultEditor\Development\Engine\SharedPCH.Engine.ShadowErrors.h.obj.response"
ERROR: System.ComponentModel.Win32Exception (5): Access is denied.
          at EpicGames.Core.ManagedProcess.CreateManagedProcessWin32(ManagedProcessGroup Group, String FileName, String CommandLine, String WorkingDirectory, IReadOnlyDictionary`2 Environment, ProcessPriorityClass Priority, ManagedProcessFlags ManagedFlags) in d:\build\++UE5\Sync\Engine\Source\Programs\Shared\EpicGames.Core\ManagedProcess.cs:line 657
          at EpicGames.Core.ManagedProcess..ctor(ManagedProcessGroup Group, String FileName, String CommandLine, String WorkingDirectory, IReadOnlyDictionary`2 Environment, ProcessPriorityClass Priority, ManagedProcessFlags Flags) in d:\build\++UE5\Sync\Engine\Source\Programs\Shared\EpicGames.Core\ManagedProcess.cs:line 476
          at EpicGames.Core.ManagedProcess..ctor(ManagedProcessGroup Group, String FileName, String CommandLine, String WorkingDirectory, IReadOnlyDictionary`2 Environment, Byte[] Input, ProcessPriorityClass Priority, ManagedProcessFlags Flags) in d:\build\++UE5\Sync\Engine\Source\Programs\Shared\EpicGames.Core\ManagedProcess.cs:line 452
          at UnrealBuildTool.ParallelExecutor.ExecuteAction(ManagedProcessGroup ProcessGroup, BuildAction Action, List`1 CompletedActions, AutoResetEvent CompletedEvent) in d:\build\++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\Executors\ParallelExecutor.cs:line 402
       while launching D:\Program Files\Windows Kits\10\bin\10.0.22621.0\x64\rc.exe /nologo /D_WIN64 /l 0x409 /I "." /I "D:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\INCLUDE" /I "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8.1\include\um" /I "D:\Program Files\Windows Kits\10\include\10.0.22621.0\ucrt" /I "D:\Program Files\Windows Kits\10\include\10.0.22621.0\shared" /I "D:\Program Files\Windows Kits\10\include\10.0.22621.0\um" /I "D:\Program Files\Windows Kits\10\include\10.0.22621.0\winrt" /DIS_PROGRAM=0 /DUE_EDITOR=1 /DENABLE_PGO_PROFILE=0 /DUSE_VORBIS_FOR_STREAMING=1 /DUSE_XMA2_FOR_STREAMING=1 /DWITH_DEV_AUTOMATION_TESTS=1 /DWITH_PERF_AUTOMATION_TESTS=1 /DUNICODE /D_UNICODE /D__UNREAL__ /DIS_MONOLITHIC=0 /DWITH_ENGINE=1 /DWITH_UNREAL_DEVELOPER_TOOLS=1 /DWITH_UNREAL_TARGET_DEVELOPER_TOOLS=1 /DWITH_APPLICATION_CORE=1 /DWITH_COREUOBJECT=1 /DWITH_VERSE=0 /DUSE_STATS_WITHOUT_ENGINE=0 /DWITH_PLUGIN_SUPPORT=0 /DWITH_ACCESSIBILITY=1 /DWITH_PERFCOUNTERS=1 /DUSE_LOGGING_IN_SHIPPING=0 /DWITH_LOGGING_TO_MEMORY=0 /DUSE_CACHE_FREED_OS_ALLOCS=1 /DUSE_CHECKS_IN_SHIPPING=0 /DUSE_ESTIMATED_UTCNOW=0 /DWITH_EDITOR=1 /DWITH_IOSTORE_IN_EDITOR=1 /DWITH_SERVER_CODE=1 /DWITH_PUSH_MODEL=1 /DWITH_CEF3=1 /DWITH_LIVE_CODING=1 /DWITH_CPP_MODULES=0 /DWITH_CPP_COROUTINES=0 /DUBT_MODULE_MANIFEST="UnrealEditor.modules" /DUBT_MODULE_MANIFEST_DEBUGGAME="UnrealEditor-Win64-DebugGame.modules" /DUBT_COMPILED_PLATFORM=Win64 /DUBT_COMPILED_TARGET=Editor /DUE_APP_NAME="UnrealEditor" /DNDIS_MINIPORT_MAJOR_VERSION=0 /DWIN32=1 /D_WIN32_WINNT=0x0601 /DWINVER=0x0601 /DPLATFORM_WINDOWS=1 /DPLATFORM_MICROSOFT=1 /DOVERRIDE_PLATFORM_HEADER_NAME=Windows /DRHI_RAYTRACING=1 /DNDEBUG=1 /DUE_BUILD_DEVELOPMENT=1 /DORIGINAL_FILE_NAME="UnrealEditor-ObstacleAssault.dll" /DBUILT_FROM_CHANGELIST=20979098 /DBUILD_VERSION=++UE5+Release-5.0-CL-20979098 /DBUILD_ICON_FILE_NAME="\"..\\Build\\Windows\\Resources\\Default.ico\"" /DPROJECT_COPYRIGHT_STRING="Fill out your copyright notice in the Description page of Project Settings." /DPROJECT_PRODUCT_NAME=HourOfCode_UE /DPROJECT_PRODUCT_IDENTIFIER=ObstacleAssault /fo "D:\Development Projects\Udemy UE5\Unreal Engine 5 CPP Developer\ObstacleAssault\Intermediate\Build\Win64\UnrealEditor\Development\ObstacleAssault\Default.rc2.res" "..\Build\Windows\Resources\Default.rc2"
[2/9] Resource Default.rc2
[2/9]Resource Default.rc2 - Error but no output
[2/9]Resource Default.rc2 - 1 D:\Full Games\Epic Games\UE_5.0\Engine\Source D:\Program Files\Windows Kits\10\bin\10.0.22621.0\x64\rc.exe /nologo /D_WIN64 /l 0x409 /I "." /I "D:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\INCLUDE" /I "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8.1\include\um" /I "D:\Program Files\Windows Kits\10\include\10.0.22621.0\ucrt" /I "D:\Program Files\Windows Kits\10\include\10.0.22621.0\shared" /I "D:\Program Files\Windows Kits\10\include\10.0.22621.0\um" /I "D:\Program Files\Windows Kits\10\include\10.0.22621.0\winrt" /DIS_PROGRAM=0 /DUE_EDITOR=1 /DENABLE_PGO_PROFILE=0 /DUSE_VORBIS_FOR_STREAMING=1 /DUSE_XMA2_FOR_STREAMING=1 /DWITH_DEV_AUTOMATION_TESTS=1 /DWITH_PERF_AUTOMATION_TESTS=1 /DUNICODE /D_UNICODE /D__UNREAL__ /DIS_MONOLITHIC=0 /DWITH_ENGINE=1 /DWITH_UNREAL_DEVELOPER_TOOLS=1 /DWITH_UNREAL_TARGET_DEVELOPER_TOOLS=1 /DWITH_APPLICATION_CORE=1 /DWITH_COREUOBJECT=1 /DWITH_VERSE=0 /DUSE_STATS_WITHOUT_ENGINE=0 /DWITH_PLUGIN_SUPPORT=0 /DWITH_ACCESSIBILITY=1 /DWITH_PERFCOUNTERS=1 /DUSE_LOGGING_IN_SHIPPING=0 /DWITH_LOGGING_TO_MEMORY=0 /DUSE_CACHE_FREED_OS_ALLOCS=1 /DUSE_CHECKS_IN_SHIPPING=0 /DUSE_ESTIMATED_UTCNOW=0 /DWITH_EDITOR=1 /DWITH_IOSTORE_IN_EDITOR=1 /DWITH_SERVER_CODE=1 /DWITH_PUSH_MODEL=1 /DWITH_CEF3=1 /DWITH_LIVE_CODING=1 /DWITH_CPP_MODULES=0 /DWITH_CPP_COROUTINES=0 /DUBT_MODULE_MANIFEST="UnrealEditor.modules" /DUBT_MODULE_MANIFEST_DEBUGGAME="UnrealEditor-Win64-DebugGame.modules" /DUBT_COMPILED_PLATFORM=Win64 /DUBT_COMPILED_TARGET=Editor /DUE_APP_NAME="UnrealEditor" /DNDIS_MINIPORT_MAJOR_VERSION=0 /DWIN32=1 /D_WIN32_WINNT=0x0601 /DWINVER=0x0601 /DPLATFORM_WINDOWS=1 /DPLATFORM_MICROSOFT=1 /DOVERRIDE_PLATFORM_HEADER_NAME=Windows /DRHI_RAYTRACING=1 /DNDEBUG=1 /DUE_BUILD_DEVELOPMENT=1 /DORIGINAL_FILE_NAME="UnrealEditor-ObstacleAssault.dll" /DBUILT_FROM_CHANGELIST=20979098 /DBUILD_VERSION=++UE5+Release-5.0-CL-20979098 /DBUILD_ICON_FILE_NAME="\"..\\Build\\Windows\\Resources\\Default.ico\"" /DPROJECT_COPYRIGHT_STRING="Fill out your copyright notice in the Description page of Project Settings." /DPROJECT_PRODUCT_NAME=HourOfCode_UE /DPROJECT_PRODUCT_IDENTIFIER=ObstacleAssault /fo "D:\Development Projects\Udemy UE5\Unreal Engine 5 CPP Developer\ObstacleAssault\Intermediate\Build\Win64\UnrealEditor\Development\ObstacleAssault\Default.rc2.res" "..\Build\Windows\Resources\Default.rc2"

 *  The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command Engine\Build\BatchFiles\Build.bat ObstacleAssaultEditor Win64 Development 'D:\Development Projects\Udemy UE5\Unreal Engine 5 CPP Developer\ObstacleAssault\ObstacleAssault.uproject' -waitmutex" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

That typically means that your current user doesn’t have access to files that are needed for the build process. Perhaps try running takeown /F "D:\Development Projects" in console. If that doesn’t work, check if any files in your project directory are read-only, and clear their read-only status if they are.

1 Like

There are no files in my project directory that are readonly. I also removed the readonly flag from all of the files in the “Epic Games\UE_5.0” directory. I ran the takeown command recursively on my “Development Projects” directory as well as on the “Epic Games\UE_5.0” directory.

Started VSCode as Administrator, still getting the same Access Denied error.

** Edit**
On re-reading through your error output, I realize that our issues are outputting slightly different things. You can give the below earlier posted suggestion a try, but it very well may not work - my apologies I had misread your output the first time.

** Original reply below**

Hey CypherZAR. Bear with me for a second, this seems extremely stupid - but is the only way I’ve been able to build and launch from VS over the last month.

When building and getting the error, navigate to Engine/Source/Programs/Shared/EpicGames.Core/bin/Development/netcoreapp3.1

There you’ll find EpicGames.Core.dll, right click it and open the properties window → toggle hidden and then click apply (clicking OK will close the window and you will invariably need it again). It doesn’t matter what the current state of hidden is, you just want to switch it from what it was previously.

After hitting Apply, try compiling again - if your issue is anything like mine it will run right away without issue.

The next time you attempt to compile however, you will likely get the same error again. Do the same thing and just toggle the hidden flag. Again it doesn’t matter what it is (perhaps the most frustrating part, and what makes no sense to me) just reverse it from what it is currently. The compile should run again.

No idea what’s going on, but I’ve kept this EpicGames.Core.dll properties window open for weeks now as my workaround.

If you are wanting to compile without launching, simply building (at least on my side) never shows this error - so you could simply compile the project and then launch externally and everything should be ok. However I’ve found that if I want to attach for debugging I’m much better off to just launch directly from VS - which forces this workaround.