Getting "Non-editor build cannot depend on non-redistributable modules" while cooking

Whenever I try to cook a standalone build of my game, yy log is full of messages like this and I have completely no idea what is causing it.
I have an separate editor module because we’ve been extending the editor a little, but so far as much as I looked through the code, we never include Editor files in our main module. Only in the editor one, which is also added only in editor build, so what is going on?


    UATHelper: Packaging (Windows (64-bit)): UnrealBuildTool: ERROR: Non-editor build cannot depend on non-redistributable modules. d:\Unreal Projects\Insection\Binaries\Win64\Insection2DApproach-Win64-Shipping.exe depends on 'EditorStyle', 'EditorWidgets', 'Settings', 'SourceCodeAccess', 'SourceControl', 'WorkspaceMenuStructure', 'CurveAssetEditor', 'DesktopPla
    tform', 'TargetPlatform', 'MessageLog', 'ClassViewer', 'HardwareTargeting', 'DirectoryWatcher', 'AddContentDialog', 'GameProjectGeneration', 'UATHelper', 'Merge', 'BlueprintGraph', 'KismetWidgets', 'ActorPickerMode', 'RawMesh', 'ClothingSystemEditorInterface', 'AdvancedPreviewScene', 'SkeletonEditor', 'StatsViewer', 'DeviceProfileServices', 'SceneOutliner',
    'MovieSceneCaptureDialog', 'SequencerWidgets', 'SequenceRecorderSections', 'Sequencer', 'MeshReductionInterface', 'HierarchicalLODUtilities', 'HierarchicalLODOutliner', 'PixelInspectorModule', 'FunctionalTesting', 'DeviceManager', 'ExternalImagePicker', 'SharedSettingsWidgets', 'SettingsEditor', 'UnrealEdMessages', 'ScreenShotComparisonTools', 'AutomationCon
    troller', 'AutomationWindow', 'DesktopWidgets', 'ScreenShotComparison', 'ProfilerMessages', 'ProfilerClient', 'Profiler', 'SessionFrontend', 'SlateReflector', 'Layers', 'LandscapeEditor', 'Localization', 'InternationalizationSettings', 'ConfigEditor', 'ComponentVisualizers', 'DetailCustomizations', 'FoliageEdit', 'WorldBrowser', 'NewLevelDialog', 'DeviceProf
    ileEditor', 'CollectionManager', 'PlacementMode', 'TreeMap', 'SizeMap', 'ReferenceViewer', 'LauncherServices', 'IntroTutorials', 'ViewportInteraction', 'VREditor', 'LevelEditor', 'SequenceRecorder', 'AnimationEditor', 'Persona', 'AnimationModifiers', 'MeshBoneReduction', 'AnimationBlueprintEditor', 'SceneDepthPickerMode', 'SkeletalMeshEditor', 'QuadricMeshRe
    duction', 'MaterialBaking', 'MeshUtilities', 'StaticMeshEditor', 'MeshMergeUtilities', 'MaterialUtilities', 'MaterialEditor', 'MovieSceneTools', 'KismetCompiler', 'DerivedDataCache', 'HotReload', 'BlueprintCompilerCppBackend', 'BlueprintNativeCodeGen', 'BlueprintProfiler', 'Kismet', 'GraphEditor', 'LocalizationCommandletExecution', 'LocalizationService', 'Tr
    anslationEditor', 'UndoHistory', 'ProjectTargetPlatformEditor', 'OutputLog', 'LocalizationDashboard', 'MainFrame', 'TextureEditor', 'CurveTableEditor', 'DataTableEditor', 'DestructibleMeshEditor', 'FontEditor', 'AudioEditor', 'AssetTools', 'SourceControlWindows', 'PackagesDialog', 'ContentBrowser', 'Documentation', 'PropertyEditor', 'AnimGraph', 'InputBindin
    gEditor', 'SwarmInterface', 'TargetDeviceServices', 'MeshPaint', 'MeshPaintMode', 'PluginWarden', 'ClothingSystemEditor', 'PIEPreviewDeviceProfileSelector', 'BspMode', 'GameplayDebugger', 'DistCurveEditor', 'Cascade', 'UMGEditor', 'Matinee', 'EditorSettingsViewer', 'PhAT', 'ProjectLauncher', 'StringTableEditor', 'GeometryMode', 'TextureAlignMode', 'Blutility
    ', 'ShaderCompilerCommon', 'ShaderPreprocessor', 'ShaderFormatVectorVM', 'NiagaraEditor', 'MergeActors', 'ProjectSettingsViewer', 'PListEditor', 'AIGraph', 'BehaviorTreeEditor', 'EnvironmentQueryEditor', 'ViewportSnapping', 'GameplayTasksEditor', 'IOSPlatformEditor', 'HTML5TargetPlatform', 'HTML5PlatformEditor', 'GeometryCacheEd', 'OverlayEditor', 'ClothPain
    ter', 'AndroidDeviceDetection', 'AndroidPlatformEditor', 'UnrealEd'.

Here is my Target.cs file


 using UnrealBuildTool;
    using System.Collections.Generic;

    public class Insection2DApproachTarget : TargetRules
    {
        public Insection2DApproachTarget(TargetInfo Target) :
            base(Target)
        {
            Type = TargetType.Game;

            ExtraModuleNames.Add("Insection2DApproach");

            if (UEBuildConfiguration.bBuildEditor)
            {
                ExtraModuleNames.Add("Insection2DApproachCustomEditor");
            }
        }

        //
        // TargetRules interface.
        //

    }

Here is my game Build.cs file


using UnrealBuildTool;

    public class Insection2DApproach : ModuleRules
    {
        public Insection2DApproach(ReadOnlyTargetRules Target) :
            base(Target)
        {
            PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D", "CableComponent" });

            PrivateDependencyModuleNames.AddRange(new string] {  });

            // Uncomment if you are using Slate UI
            // PrivateDependencyModuleNames.AddRange(new string] { "Slate", "SlateCore" });

            // Uncomment if you are using online features
            // PrivateDependencyModuleNames.Add("OnlineSubsystem");

            // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
        }
    }

What can possible cause this? My cook log is filled with these errors, some are a little different but they all say that I’m trying to build with modules that are non-redistributable.
UE 4.17

PS: I just want to add that there is probability that this started happening AFTER migration from 4.13 to 4.17, I will revert back to 4.13 and see if it cooks properly, though we need to be on 4.17 asap

I can confirm the same setup cooks properly on 4.13 version. Can someone tell me what’s the difference when adding custom editor module on 4.17?

That doesn’t work.

Yea I just figured it out myself, removing these 4 lines:



 if (UEBuildConfiguration.bBuildEditor)
{    
    ExtraModuleNames.Add("Insection2DApproachCustomEditor");
} 

Fixes the problem.

Thank you for your answer anyway