Fail building C++ project - Access Denied [RESOLVED]

I decided do convert my character to C++ because I predict I will have some complexity down the line and the blueprint will become too complex and confusing to maintain and expand.

I created a new C++ class (I didn’t had a C++ project yet). UE Editor created the class, generated the VS solution with my class, everything looks fine. But when I compile the solution I get the following error:

|Error||Unhandled exception: System.ComponentModel.Win32Exception (5): Access is denied.|FatKnight|D:\Jo\Unreal\FatKnight\Unreal\Intermediate\ProjectFiles\UnrealBuildTool|1||

Severity Code Description Project File Line Suppression State
Error MSB3073 The command C:\Program Files\Epic Games\UE_5.0EA\Engine\Build\BatchFiles\Rebuild.bat FatKnightEditor Win64 Development -Project=D:\Jo\Unreal\FatKnight\Unreal\FatKnight.uproject -WaitMutex -FromMsBuild exited with code -1. FatKnight C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets 51

I’ve already tried the following:
-Close the editor->recompile
-Close the editor->close VS->open VS->recompile
-Delete all build files->recompile
-Remove “read only” attribute to all files under “Source”->recompile

To no avail. Googling didn’t provided an answer. Any ideas?

Let me add:
I’m using UE5 and VS2019.

A few more information. This is the output log from VS:

1>------ Skipped Build: Project: UE5, Configuration: BuiltWithUnrealBuildTool Win64 ------
1>Project not selected to build for this solution configuration
2>------ Build started: Project: FirstPersonCPP2, Configuration: Development_Editor x64 ------
2>’“C:\Program Files\Epic Games\UE_5.0EA\Engine\Build\BatchFiles\GetDotnetPath.bat”’ is not recognized as an internal or external command,
2>operable program or batch file.
2>Win64 using Manual SDK 10.0.19041.0
2>UnrealBuildTool : error : Unhandled exception: System.ComponentModel.Win32Exception (5): Access is denied.
2> at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
2> at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
2> at System.Diagnostics.Process.UpdateHasExited()
2> at System.Diagnostics.Process.get_HasExited()
2> at UnrealBuildTool.HotReload.ShouldDoHotReloadFromIDE(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDesc) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\System\HotReload.cs:line 343
2> at UnrealBuildTool.HotReload.GetDefaultMode(TargetDescriptor TargetDescriptor, BuildConfiguration BuildConfiguration) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\System\HotReload.cs:line 148
2> at UnrealBuildTool.HotReload.Setup(TargetDescriptor TargetDescriptor, TargetMakefile Makefile, List1 Actions, BuildConfiguration BuildConfiguration) in d:\build\++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\System\HotReload.cs:line 181 2> at UnrealBuildTool.BuildMode.Build(TargetMakefile[] Makefiles, List1 TargetDescriptors, BuildConfiguration BuildConfiguration, BuildOptions Options, FileReference WriteOutdatedActionsFile) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 310
2> at UnrealBuildTool.BuildMode.Execute(CommandLineArguments Arguments) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 228
2> at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in d:\build++UE5\Sync\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 565
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45,5): error MSB3073: The command ““C:\Program Files\Epic Games\UE_5.0EA\Engine\Build\BatchFiles\Build.bat” FirstPersonCPP2Editor Win64 Development -Project=“D:\Jo\Unreal\FirstPersonCPP2\FirstPersonCPP2.uproject” -WaitMutex -FromMsBuild” exited with code 6.
2>Done building project “FirstPersonCPP2.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

I pretty sure I have seen people having issues with GetDotnetPath.bat maybe search the forums for that and see if anything helps

I found a topic that suggested increasing the windows pagefile to 32gb. I did that, made a reboot and it is compiling now.
I’m not convinced that the problem was the pagefile. I think that was the reboot that solved the problem.