Was able to fix this by completely deleting the project from my local drive, clearing ALL of my temporary files and also clearing out old registry keys (using CCleaner).
Then and only then, I Force-got latest revision from perforce and built it, now it builds fine. I was confused by the fact that Unreal was creating some form of registry keys for my game though? Why would it need to do that?
It looks like the reason is because there was a persistent file that couldn’t be overwritten: UnrealBuildTool Exception: System.IO.IOException: Cannot create a file when that file already exists.
Since the file already existed, it ‘confused’ the code and caused a build failure. If you run into this issue again, could you please let us know what you had been doing before the error started occurring?
This happens to me quite often, but only when packaging the project (not just launching straight to device). I’m not sure what the conditions are for it to occur, but deleting Intermediate/Saved/Binaries folders seems to fix it.
I’ve also tried checking out the entire project in Perforce so that all files are writable, but this has no effect.
Can I suggest adding extra information to that error message so we can see exactly which file can’t be overwritten?