Packaging failed. Unable to compile source files

For some reason, whenever I try to package my game it keeps saying “packaging failed.” I know this isn’t a problem with the engine because I created a new project and tried to package that and it worked fine so it’s clearly a problem with my game. Here’s the log that was produced.

Automation.ParseCommandLine: Parsing command line: -ScriptsForProject=F:/Project/Project.uproject BuildCookRun -nocompile -nocompileeditor -installed -nop4 -project=F:/Project/Project.uproject -cook -stage -archive -archivedirectory=C:/Users/Bruce/Desktop -package -clientconfig=Development -ue4exe=UE4Editor-Cmd.exe -pak -prereqs -nodebuginfo -targetplatform=Win64 -build -utf8output
Automation.Process: Setting up command environment.
InternalUtils.SafeFileExists: SafeFileExists F:\UE_4.21\Engine\Binaries\DotNET\AutomationTool.exe=True
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_LOCAL_ROOT=
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_LOCAL_ROOT=
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_EngineSavedFolder=
CommandUtils.SetEnvVar: SetEnvVar uebp_EngineSavedFolder=F:/UE_4.21/Engine/Programs/AutomationTool/Saved
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_EngineSavedFolder=F:/UE_4.21/Engine/Programs/AutomationTool/Saved
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_CSVFile=
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_LogFolder=
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_LOCAL_ROOT=F:/UE_4.21
CommandUtils.SetEnvVar: SetEnvVar uebp_LogFolder=C:/Users/Bruce/AppData/Roaming/Unreal Engine/AutomationTool/Logs/F+UE_4.21
InternalUtils.SafeDeleteFile: SafeDeleteFile C:\Users\Bruce\AppData\Roaming\Unreal Engine\AutomationTool\Logs\F+UE_4.21\Log.txt
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_FinalLogFolder=
CommandUtils.SetEnvVar: SetEnvVar uebp_FinalLogFolder=C:/Users/Bruce/AppData/Roaming/Unreal Engine/AutomationTool/Logs/F+UE_4.21
InternalUtils.SafeFileExists: SafeFileExists C:\Windows\system32\robocopy.exe=True
InternalUtils.SafeFileExists: SafeFileExists C:\Windows\system32\mount.exe=False
InternalUtils.SafeFileExists: SafeFileExists C:\Windows\Sysnative\mount.exe=False
InternalUtils.SafeFileExists: SafeFileExists C:\Windows\system32\cmd.exe=True
CommandUtils.SetEnvVar: SetEnvVar MallocNanoZone=0
InternalUtils.GetEnvironmentVariable: GetEnvironmentVariable uebp_UATChildInstance=0
InternalUtils.SafeFileExists: SafeFileExists F:\Project\Project.uproject=True
InternalUtils.SafeFileExists: SafeFileExists F:\Project\Project.uproject=True
BuildCookRun.SetupParams: Setting up ProjectParams for F:\Project\Project.uproject
InternalUtils.SafeFileExists: SafeFileExists C:\Users\Bruce\AppData\Local\Temp\UAT\F+UE_4.21\Rules\UATRules-1515341865.dll=False
DynamicCompilation.CompileAssembly: While compiling C:\Users\Bruce\AppData\Local\Temp\UAT\F+UE_4.21\Rules\UATRules-1515341865.dll:
DynamicCompilation.CompileAssembly: f:\Project\Source\OceanProject.Target.cs(19,12) : error CS0246: The type or namespace name 'UEBuildBinaryConfiguration' could not be found (are you missing a using directive or an assembly reference?)
DynamicCompilation.CompileAssembly: f:\Project\Source\OceanProjectEditor.Target.cs(19,12) : error CS0246: The type or namespace name 'UEBuildBinaryConfiguration' could not be found (are you missing a using directive or an assembly reference?)
Log.WriteException: ==============================================================================
Log.WriteException: ERROR: Unable to compile source files.
Log.WriteException:        (see C:\Users\Bruce\AppData\Roaming\Unreal Engine\AutomationTool\Logs\F+UE_4.21\Log.txt for full exception trace)
Log.WriteException: 
Log.WriteException: BuildException: Unable to compile source files.
Log.WriteException:    at UnrealBuildTool.DynamicCompilation.CompileAssembly(FileReference OutputAssemblyPath, List`1 SourceFileNames, List`1 ReferencedAssembies, List`1 PreprocessorDefines, Boolean TreatWarningsAsErrors) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 378
Log.WriteException:    at UnrealBuildTool.DynamicCompilation.CompileAndLoadAssembly(FileReference OutputAssemblyPath, List`1 SourceFileNames, List`1 ReferencedAssembies, List`1 PreprocessorDefines, Boolean DoNotCompile, Boolean TreatWarningsAsErrors) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\System\DynamicCompilation.cs:line 448
Log.WriteException:    at AutomationTool.ProjectUtils.CompileAndLoadTargetsAssembly(ProjectProperties Properties, FileReference TargetsDllFilename, Boolean DoNotCompile, List`1 TargetScripts) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectUtils.cs:line 558
Log.WriteException:    at AutomationTool.ProjectUtils.DetectTargetsForProject(ProjectProperties Properties, List`1 ExtraSearchPaths) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectUtils.cs:line 535
Log.WriteException:    at AutomationTool.ProjectUtils.DetectProjectProperties(FileReference RawProjectPath, List`1 ClientTargetPlatforms, List`1 ClientTargetConfigurations, Boolean AssetNativizationRequested) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectUtils.cs:line 350
Log.WriteException:    at AutomationTool.ProjectUtils.GetProjectProperties(FileReference RawProjectPath, List`1 ClientTargetPlatforms, List`1 ClientTargetConfigurations, Boolean AssetNativizationRequested) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectUtils.cs:line 99
Log.WriteException:    at AutomationTool.ProjectParams.AutodetectSettings(Boolean bReset) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectParams.cs:line 2005
Log.WriteException:    at AutomationTool.ProjectParams..ctor(FileReference RawProjectPath, BuildCommand Command, String Device, String MapToRun, String AdditionalServerMapParams, ParamList`1 Port, String RunCommandline, String StageCommandline, String BundleName, String StageDirectoryParam, String UE4Exe, String SignPak, List`1 ClientConfigsToBuild, List`1 ServerConfigsToBuild, ParamList`1 MapsToCook, ParamList`1 MapIniSectionsToCook, ParamList`1 DirectoriesToCook, String InternationalizationPreset, ParamList`1 CulturesToCook, ParamList`1 ClientCookedTargets, ParamList`1 EditorTargets, ParamList`1 ServerCookedTargets, List`1 ClientTargetPlatforms, Dictionary`2 ClientDependentPlatformMap, List`1 ServerTargetPlatforms, Dictionary`2 ServerDependentPlatformMap, Nullable`1 Build, Nullable`1 SkipBuildClient, Nullable`1 SkipBuildEditor, Nullable`1 Cook, Nullable`1 Run, Nullable`1 SkipServer, Nullable`1 Clean, Nullable`1 Compressed, String AdditionalPakOptions, Nullable`1 IterativeCooking, String IterateSharedCookedBuild, Nullable`1 IterateSharedBuildUsePrecompiledExe, Nullable`1 CookAll, Nullable`1 CookPartialGC, Nullable`1 CookInEditor, String CookOutputDir, Nullable`1 CookMapsOnly, Nullable`1 CookOnTheFly, Nullable`1 CookOnTheFlyStreaming, Nullable`1 UnversionedCookedContent, Nullable`1 EncryptIniFiles, Nullable`1 EncryptPakIndex, Nullable`1 EncryptEverything, Nullable`1 SkipCookingEditorContent, Nullable`1 NumCookersToSpawn, String AdditionalCookerOptions, String BasedOnReleaseVersion, String CreateReleaseVersion, String CreateReleaseVersionBasePath, String BasedOnReleaseVersionBasePath, Nullable`1 GeneratePatch, Nullable`1 AddPatchLevel, Nullable`1 StageBaseReleasePaks, Nullable`1 GenerateRemaster, String DiscVersion, String DLCName, String DiffCookedContentPath, Nullable`1 DLCIncludeEngineContent, Nullable`1 DLCPakPluginFile, Nullable`1 DLCActLikePatch, Nullable`1 CrashReporter, Nullable`1 DedicatedServer, Nullable`1 Client, Nullable`1 Deploy, String DeployFolder, String GetFile, Nullable`1 FileServer, Nullable`1 Foreign, Nullable`1 ForeignCode, Nullable`1 LogWindow, Nullable`1 NoCleanStage, Nullable`1 NoClient, Nullable`1 NoDebugInfo, Nullable`1 SeparateDebugInfo, Nullable`1 MapFile, Nullable`1 NoXGE, Nullable`1 Package, Nullable`1 Pak, Nullable`1 Prereqs, String AppLocalDirectory, Nullable`1 NoBootstrapExe, Nullable`1 SignedPak, Nullable`1 NullRHI, Nullable`1 FakeClient, Nullable`1 EditorTest, Nullable`1 RunAutomationTests, String RunAutomationTest, Nullable`1 CrashIndex, Nullable`1 SkipCook, Nullable`1 SkipCookOnTheFly, Nullable`1 SkipPak, Nullable`1 PrePak, Nullable`1 SkipStage, Nullable`1 Stage, Nullable`1 Manifests, Nullable`1 CreateChunkInstall, Nullable`1 Unattended, Nullable`1 NumClients, Nullable`1 Archive, String ArchiveDirectoryParam, Nullable`1 ArchiveMetaData, Nullable`1 CreateAppBundle, String SpecifiedClientTarget, String SpecifiedServerTarget, ParamList`1 ProgramTargets, Nullable`1 Distribution, Nullable`1 Prebuilt, Nullable`1 RunTimeoutSeconds, String SpecifiedArchitecture, String UbtArgs, Nullable`1 IterativeDeploy, Nullable`1 FastCook, Nullable`1 IgnoreCookErrors, Nullable`1 RunAssetNativization, Nullable`1 CodeSign, Nullable`1 TreatNonShippingBinariesAsDebugFiles, Nullable`1 UseExtraFlavor, String Provision, String Certificate, String Team, Boolean AutomaticSigning, ParamList`1 InMapsToRebuildLightMaps, ParamList`1 InMapsToRebuildHLOD, ParamList`1 TitleID) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectParams.cs:line 1043
Log.WriteException:    at BuildCookRun.SetupParams() in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 52
Log.WriteException:    at BuildCookRun.ExecuteBuild() in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 39
Log.WriteException:    at AutomationTool.BuildCommand.Execute() in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 242
Log.WriteException:    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 563
Log.WriteException:    at AutomationTool.Automation.Process(String[] Arguments, StartupTraceListener StartupListener) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 533
Log.WriteException:    at AutomationTool.Program.MainProc(String[] Arguments, StartupTraceListener StartupListener) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:line 173
Log.WriteException:    at AutomationTool.Program.<>c__DisplayClass1_0.<Main>b__2() in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:line 99
Log.WriteException:    at AutomationTool.InternalUtils.RunSingleInstance(Func`1 Main) in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:line 725
Log.WriteException:    at AutomationTool.Program.Main() in D:\Build\++UE4\Sync\Engine\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:line 99
Log.WriteException: ==============================================================================
Program.Main: AutomationTool exiting with ExitCode=1 (Error_Unknown)

Here is OceanProject.Target.cs

// 2015 - Community based open project

using UnrealBuildTool;
using System.Collections.Generic;

public class OceanProjectTarget : TargetRules
{
	public OceanProjectTarget(TargetInfo Target)
	{
		Type = TargetType.Game;
	}

	//
	// TargetRules interface.
	//

	public override void SetupBinaries(
		TargetInfo Target,
		ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
		ref List<string> OutExtraModuleNames
		)
	{
		OutExtraModuleNames.AddRange( new string[] { "OceanProject" } );
	}
}

and here is OceanProjectEditor.Target
// 2015 - Community based open project

using UnrealBuildTool;
using System.Collections.Generic;

public class OceanProjectEditorTarget : TargetRules
{
	public OceanProjectEditorTarget(TargetInfo Target)
	{
		Type = TargetType.Editor;
	}

	//
	// TargetRules interface.
	//

	public override void SetupBinaries(
		TargetInfo Target,
		ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
		ref List<string> OutExtraModuleNames
		)
	{
		OutExtraModuleNames.AddRange( new string[] { "OceanProject" } );
	}
}

Hello,

Can you show OceanProject.Target.cs, OceanProjectEditor.Target.cs and tell project name?

Are you using ocean project from github?

Yes I am using ocean project from github. The project name is just called Project

Ok, I edited my post to include OceanProject.Target.cs and OceanProjectEditor.Target.cs

Download latest version of ocean project and it will work for sure :slight_smile:

If you just coppied plugin into project than just replace it with latest version.

What is the latest version of ocean project? In other words, what branch of the github version should I use?

You should use master for latest version or version dedicated for your engine version. I see you are using 4.21 and that’s the only one that doesn’t exists. I would go about 4.22 or upgrade project.

Your error is in project code is this log from (see C:\Users\Bruce\AppData\Roaming\Unreal Engine\AutomationTool\Logs\F+UE_4.21\Log.txt for full exception trace)?