RunUAT BuildCookRun deletes AutomationScripts folder

I’m trying to follow this wiki to package my game:

As posted in the wiki, I’m running this command line:

C:\>"c:\Program Files\Epic Games\4.8\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun -project="" -noP4 -platform=Win64 -clientconfig=Development -serverconfig=Development -cook -allmaps -build -stage -pak -archive -archivedirectory="c:\output"

Here’s the problem – the script first deletes this folder:

Automation.Process: Compiling scripts.
ScriptCompiler.CleanupScriptsAssemblies: Cleaning up script DLL folder
InternalUtils.SafeDeleteDirectory: SafeDeleteDirectory c:\Program Files\Epic Games\4.8\Engine\Binaries\DotNET\AutomationScripts

The script goes on to delete that folder and all its contents, and then immediately afterwards it complains that the folder isn’t here:

ScriptCompiler.LoadPreCompiledScriptAssemblies: Loading precompiled script DLLs
ScriptCompiler.LoadPreCompiledScriptAssemblies: ERROR: Scripts folder c:\Program Files\Epic Games\4.8\Engine\Binaries\DotNET\AutomationScripts does not exist!
Program.Main: ERROR: AutomationTool terminated with exception:
Program.Main: ERROR: Exception in AutomationTool: AutomationScripts.Automation.dll was not found or could not be loaded,
 can't run scripts.
Stacktrace:    at AutomationTool.ScriptCompiler.LoadPreCompiledScriptAssemblies(List`1 OutScriptAssemblies)
   at AutomationTool.ScriptCompiler.FindAndCompileAllScripts(List`1 AdditionalScriptsFolders)
   at AutomationTool.Automation.Process(String[] CommandLine)
   at AutomationTool.Program.MainProc(Object Param)
   at AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param)
   at AutomationTool.Program.Main()
Program.Main: ERROR: AutomationScripts.Automation.dll was not found or could not be loaded, can't run scripts.

Am I doing something wrong? I’m not sure why the batch file would nuke the folder and then complain that it is missing… Can someone help?

thanks,
sam

I’m having the exact same issue at the moment.
Any help on this problem would be greatly appreciated.

Thanks in advance,
Huib,

What version of the engine are you using? I’m wondering if jumping to 4.9 will help…

thank,
sam

I am using 4.7. So it might be a good idea to jump to 4.9, it’s worth a try

Sam, did you manage to solve the problem?

Huib,

I haven’t been able to fix. I’m not able to upgrade easily right now, so I started diving into the source code to try to figure out if something is going wrong. I was able to add some flags which got me slightly further but there was just a different crash/error at that point. I’ll try to let you know…

Were you able to make any further progress?

thanks,
sam

Sam,
Unfortunately I was not able to make any progress either.
Upgrading to 4.9 didn’t solve the problem.

I’ll keep searching the forum and try to find an answer, but up to this point I was not able to find much information regarding this topic.
I let you know if I make any progress.

Huib

Hi,

with the -compile option on, it seems to behave this way. I’ve gotten it to work with the following 2 steps:

  1. Re-verify your engine using the epic games launcher which will rebuild your scripts directory.
  2. Remove the -compile option or change to -nocompile in your runUAT command parameters.

With the compile option on, I can only get it to compile in the editor… not in a batch command by running the same build parameters that were in the editor log outside in an dos prompt. If someone has solved this problem, please let me know. As I have to compile manually in the editor before triggering a build in my jenkins server which makes my build less automated.

RichardSo, which engine version do you use?
I have tested it with 4.7 and 4.9 but still get errors.

I use 4.9. This is my shell script which I use in Jenkins CI tool:
For Android:
/Users/Shared/UnrealEngine/4.9/Engine/Build/BatchFiles/RunUAT.command BuildCookRun -rocket -nocompile -nocompileeditor -installed -nop4 -project="$projectfile" -cook -stage -archive -archivedirectory="$outputdir" -package -clientconfig=$buildtype -ue4exe=UE4Editor -clean -compressed -CookAll -pak -prereqs -distribution -nodebuginfo -targetplatform=Android -build -utf8output

For iOS

/Users/Shared/UnrealEngine/4.9/Engine/Build/BatchFiles/RunUAT.command BuildCookRun -rocket -nocompile -nocompileeditor -installed -nop4 -project="$projectfile" -cook -stage -archive -archivedirectory="$outputdir" -package -clientconfig=$buildtype -ue4exe=UE4Editor -clean -compressed -CookAll -pak -prereqs -distribution -nodebuginfo -targetplatform=IOS -build -utf8output

Do you only package for Android and iOS or also for Windows?
At the moment I am focussing on Windows and possibly going to package for Andorid and iOS in the future.

If you package for Windows do you only change the targetplatform to Win64 in this command?

I currently only build for Android and iOS. But you can retrieve the command issued by the editor from the console output when you package your project within the editor. That is how I figured out the parameters to use … by looking at the console log and checking what was submitted when I triggered the packaging process from the editor.

Thank you.
I will look into it

Hi RichardSo,

I changed the command and as I result I don’t get this error anymore but unfortunately a different one. Looks like it has to do with the UnrealHeaderTool.
The version of the editor that I’m using is 4.9

This is the error message from the log:

008UnrealBuildTool: ERROR: Couldn’t find target rules file for target ‘UnrealHeaderTool’ in rules assembly ‘UE4ModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.
008UnrealBuildTool: Location: C:\Program Files\Epic Games\4.9\Engine\Intermediate\Build\BuildRules\UE4ModuleRules.dll
008UnrealBuildTool: Target rules found:
008UnrealBuildTool: UE4Editor - C:\Program Files\Epic Games\4.9\Engine\Source\UE4Editor.Target.cs
008UnrealBuildTool: UE4Game - C:\Program Files\Epic Games\4.9\Engine\Source\UE4Game.Target.cs
008UnrealBuildTool: UnrealHeaderTool failed for target ‘Editor’ (platform: Win64, module info: D:\ UnrealEngine\Project\Intermediate\Build\Win64\Editor\Development\UnrealHeaderTool.manifest).

Did you came across this error or do you see this one for the first time now?

I Haven’t seen this error before. I would verify my UE4 installation again (from the epic games launcher) and then try to package from the editor again.

When this happened to me a few days ago verifying the engine install fixed things. The problem was instigated by copying a RunUAT script with -compile on - seems that it would be good to do some error checking BEFORE deleting installed files!