Need help solving error when running GenerateProjectFiles.bat

Hi all!

I’m currently trying to build UE4 from source for a multiplayer project that I’m helping with. The only issue is that I can’t get past GenerateProjectFiles. Every time I run the .bat file I get the same error:

Setting up Unreal Engine 4 project files...
CSC : error CS0009: Metadata file 'C:\Program Files (x86)\Reference Assemblies\
Microsoft\Framework\.NETFramework\v4.5\System.Windows.Forms.dll' could not be o
pened -- An attempt was made to move the file pointer before the beginning of t
he file. [C:\Users\Brian's\Desktop\UE4\UnrealEngine-release\Engine\Source\Progr
ams\UnrealBuildTool\UnrealBuildTool.csproj]

GenerateProjectFiles ERROR: UnrealBuildTool failed to compile.

Press any key to continue . . .

I’ve looked everywhere online but I can’t seem to find a solution. If anyone could help me figure out how to fix this it would be greatly appreciated.

Additional Details:
So far I’ve tried a couple of solutions to fix the error but none of the following have worked so far.

  • Uninstall and reinstalling .Net 4.5
  • Turning off antivirus when running the .bat files
  • Deleting the folder and re-downloading the source
  • Downloading and extracting source from .zip and using that folder
  • Running all bat files as administrator
  • Made sure the specified file does exist (It does and it’s the same path specified in the error)
  • Re-installed VS 2017 making sure all additional packages involving c++ are installed

None of the above has worked for me so if anyone knows another fix that works it would be a lifesaver. Thank you for any and all answers!