Unreal Engine 4.25 source code compile error

When trying to build a version 4.25 engine, this error is issued:

Severity Code Description Project File Line Suppression State
Error MSB4018 The “SetEnv” task failed unexpectedly.
System.ArgumentException: Environment variable name or value is too long.
at System.Environment.SetEnvironmentVariable(String variable, String value)
at System.Environment.SetEnvironmentVariable(String variable, String value, EnvironmentVariableTarget target)
at Microsoft.Build.CPPTasks.SetEnv.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() UE4 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Current.targets 82

How can this be solved?

2 Likes

Solved. Simply deleted the paths to the inclusions, since there were strange paths in them.

4 Likes

Interesting finding, I had the same problem on “promoted” branch and switched to another.

thank you for sharing, it should be helpful to know where to look for next errors.
what branch are you using for source build?

Thanks for Posting - this fixed the issue for me.

Thanks @Di-Shiper this worked for me using the last ue5_main version from github today.