UnrealBuildTool generates System.IO.PathTooLongException

UnrealBuildTool seems to be using .net 4.5 which has a known bug that causes System.IO.PathTooLongException to be thrown on paths longer than 260 characters (yes I know this crops up in lots of legacy windows APIs, but its not a modern limitation). This has been causing us grief recently on our automated build machine (which generates unique directories for each build), as well as cropping up from time to time from different devs that clone our project to different directories. We have worked around this on our CI machine by mounting as close to the root as possible, but some of the paths are still awfully close to the limit and make us a bit uncomfortable (~250 characters).

The good news is that .net 4.6.2 fixes the issue (see: Announcing .NET Framework 4.6.2 - .NET Blog), so ideally UnrealBuildTool updates its target .net version and we can stop forcing everyone to clone directly to their C drive.

Fwiw, I tried retargeting UBT myself using the provided instructions, but it eventually fails in DynamicCompilation.cs, and I’m not enough of a C# programmer to try to remedy that.

It would be good if Epic could update their tools to take advantage of this change in Windows.