So, every so often when automatic project build is run on the build agent, the build fails with the following error (this is on a 4.27.2 branch of the unreal engine):
Parsing command line: BuildCookRun -project=D:\Project.uproject -noP4 -clientconfig=Shipping -serverconfig=Shipping -utf8output -build -cook -map=Map -pak -createreleaseversion= -manifests -distribution -stage -package -stagingdirectory=D:\Staging -cmdline=" -Messaging" -addcmdline="-SessionId=[Guid]::NewGuid().ToString(N).ToUpper() -SessionOwner='Build Agent' -SessionName='Session'" -compile -platform=Win64 -targetplatform=Win64 -ddc=noshared -compile
Dependencies are out of date. Compiling scripts....
FastJSON\Getters.cs(5,25): warning CS1692: Invalid number [C:\Projects\DevKit\Engine\Source\Programs\DotNETCommon\DotNETUtilities\DotNETUtilities.csproj]
FastJSON\Getters.cs(16,25): warning CS1692: Invalid number [C:\Projects\DevKit\Engine\Source\Programs\DotNETCommon\DotNETUtilities\DotNETUtilities.csproj]
FastJSON\JSON.cs(13,25): warning CS1692: Invalid number [C:\Projects\DevKit\Engine\Source\Programs\DotNETCommon\DotNETUtilities\DotNETUtilities.csproj]
FastJSON\JSON.cs(903,25): warning CS1692: Invalid number [C:\Projects\DevKit\Engine\Source\Programs\DotNETCommon\DotNETUtilities\DotNETUtilities.csproj]
Perforce\PerforceError.cs(11,26): warning CS1692: Invalid number [C:\Projects\DevKit\Engine\Source\Programs\DotNETCommon\DotNETUtilities\DotNETUtilities.csproj]
Perforce\PerforceError.cs(47,26): warning CS1692: Invalid number [C:\Projects\DevKit\Engine\Source\Programs\DotNETCommon\DotNETUtilities\DotNETUtilities.csproj]
CSC : error CS1617: Invalid option '6' for /langversion; must be ISO-1, ISO-2, 3, 4, 5 or Default [C:\Projects\DevKit\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.csproj]
Took 1.578244s to run MSBuild.exe, ExitCode=1
If this happens, I just rerun the build again and it works without any issues. Then, ten or so builds down the line, this error will appear once again.
The DotNETCommon
folder isn’t source controlled, it’s one of the dependency unreal pulls when it sets up itself. I’ve looked up what the offending lines are and it’s these two in every case:
#pragma warning disable CS1591
#pragma warning restore CS1591
The only difference that the FastJSON ones are wrapped:
#if !__MonoCS__
#pragma warning disable CS1591
#endif
#if !__MonoCS__
#pragma warning restore CS1591
#endif
I’ve also looked at ‘UnrealBuildTool.csproj’ and there are these two lines:
<!-- The mono compiler used to ship on Mac is only compatible with version 6 -->
<LangVersion>6</LangVersion>
Given that the game is never shipped for Mac, I assume I can just set the LangVersion
to 5
and call it a day. But that seems dirty.
To me, it looks like the dependencies are outdated, suppressing a warning that is no longer valid for C# version 6.
Anything other could be done other than downgrading the UnrealBuildTool
to use language version 5
instead of 6
?