[SOLVED] Visual Studio 2019 Source Build -> cmd.exe Access Denied

So apparently there is no info in regards to an error which complains about a permission issue involving cmd.exe / Build.bat. While there are basic permission issues reported, which can be resolved by running VS as admin, it won’t work in all instances.

|Warning||Unable to create process C:\WINDOWS\system32\cmd.exe (access denied)

|Error|MSB3073|The command C:\UE\Source-4.26.2\Engine\Build\BatchFiles\Build.bat SA_SERVER Win64 Development -Project=C:\UE\SPACEALPHA_SERVER\SPACEALPHA_SERVER.uproject -WaitMutex -FromMsBuild exited with code 6. ( ERROR_INVALID_HANDLE)


Build.bat fails exited with code 6

Another issue may be that the source build is not visible when you Switch your Project version to the source build, in which case you can manually assign it by clicking the 3 dots (see image).

When building from command line this is the output:

“c:\UE\SPACEALPHA_SERVER\SPACEALPHA_SERVER.sln” (default target) (1) →
“c:\UE\SPACEALPHA_SERVER\Intermediate\ProjectFiles\HeadlessChaos.vcxproj.metaproj” (default target) (2) →
“c:\UE\SPACEALPHA_SERVER\Intermediate\ProjectFiles\HeadlessChaos.vcxproj” (default target) (5) →
(Build target) →

C:/UE/Source-4.26.2/Engine/Source/Runtime/Core/Private/HoloLens/HoloLensPlatformMemory.cpp(65): error C2061: syntax e
rror: identifier ‘FMallocTBB’ [c:\UE\SPACEALPHA_SERVER\Intermediate\ProjectFiles\HeadlessChaos.vcxproj]

C:/UE/Source-4.26.2/Engine/Source/Programs/HeadlessChaos/Private/HeadlessChaosApp.cpp(428): error C4447: ‘main’ signa
ture found without threading model. Consider using ‘int main(Platform::ArrayPlatform::String^^ args)’. [c:\UE\SPACEAL

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(45
,5): error MSB3073: The command “C:\UE\Source-4.26.2\Engine\Build\BatchFiles\Build.bat HeadlessChaos HoloLens Debug -Wa
itMutex -FromMsBuild” exited with code 6. [c:\UE\SPACEALPHA_SERVER\Intermediate\ProjectFiles\HeadlessChaos.vcxproj]

The solution

  • Redownloaded the Source 4.26.2 branch.
  • Run Setup.bat as admin
  • Run GenerateProjectFiles.bat as admin
  • Then was able to build with this branch, without errors.

Probable Issues preventing the Build earlier

  • Did not run the *bat files as admin.
  • Two days earlier the branch download through Setup.bat stopped several times with: Unable to connect to the remote server (WebException) - but finished successful after restarts.

While looking into the various possible issues, including reading the official instructions, the forum, AnswerHub - nowhere could I spot mention of above issue / method.