# How do we exclude editor modules from non-editor configurations in 4.16?

**URL:** <https://forums.unrealengine.com/t/how-do-we-exclude-editor-modules-from-non-editor-configurations-in-4-16/398556>\
**Category:** Platform & Builds\
**Tags:** target, UE4-16, unreal-engine, editor, packaging-projects, question, CPP\
**Created:** [June 10, 2017, 1:01am UTC](https://forums.unrealengine.com/t/how-do-we-exclude-editor-modules-from-non-editor-configurations-in-4-16/398556 "2017-06-10T01:01:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teiwaz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teiwaz](https://forums.unrealengine.com/u/Teiwaz)\
**Post date:** [June 10, 2017, 1:01am UTC](https://forums.unrealengine.com/t/how-do-we-exclude-editor-modules-from-non-editor-configurations-in-4-16/398556/1 "2017-06-10T01:01:14Z")

</div>

In 4.16, the TargetRules class (the class defined in a module’s .Target.cs file) changed, and the SetupBinaries function was deprecated.

In 4.15 and before, the usual method for adding an Editor Module to a project was to add it to the ExtraModuleNames array in SetupBinaries if UEBuildConfiguration.bBuildEditor was true.

In 4.16, adding these ExtraModuleNames needed to get moved into the target constructor. However, it appears that in the constructor. UEBuildConfiguration.bBuildEditor is _always_ true, even for configurations where the editor should not be built. This means that using the old method (just moved to the constructor from SetupBinaries) any Editor Modules are always included in the build, which will frequently cause build failures when your Editor Module starts trying to reference editor-only files or data which aren’t included in non-editor builds.

Does anyone have any clue as to how we should be excluding Editor Modules from our main module’s Target class in 4.16?

---

<div class="post-metadata">

**Author:** ![Teiwaz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teiwaz](https://forums.unrealengine.com/u/Teiwaz)\
**Post date:** [June 12, 2017, 5:42pm UTC](https://forums.unrealengine.com/t/how-do-we-exclude-editor-modules-from-non-editor-configurations-in-4-16/398556/2 "2017-06-12T17:42:07Z")

</div>

I think I’ve solved it.

Replaced  
UEBuildConfiguration.bBuildEditor  
with  
Target.Type == TargetType.Editor

I no longer get errors related to editor-only types when compiling Development or DebugGame, and my editor module functionality still works when I compile with DebugGame Editor or Development Editor.

Packaging a project is still failing when cooking assets, but so far it doesn’t seem to be related to this.

---

<div class="post-metadata">

**Author:** ![LuaChunk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LuaChunk](https://forums.unrealengine.com/u/LuaChunk)\
**Post date:** [June 24, 2017, 5:08am UTC](https://forums.unrealengine.com/t/how-do-we-exclude-editor-modules-from-non-editor-configurations-in-4-16/398556/3 "2017-06-24T05:08:18Z")

</div>

This worked for me, thanks!

---

<div class="post-metadata">

**Author:** ![Elkantor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Elkantor](https://forums.unrealengine.com/u/Elkantor)\
**Post date:** [July 27, 2017, 7:46am UTC](https://forums.unrealengine.com/t/how-do-we-exclude-editor-modules-from-non-editor-configurations-in-4-16/398556/4 "2017-07-27T07:46:17Z")

</div>

Thanks a lot, you save my day haha 😉 The documentation for creating a module editor hasn’t change, so I was blocked to create my first one. I think it’s because of that (not sure) 🙂
