Linking error with user library

I try to link my library with an UE4 module (Debug Editor) but I keep getting an error.

error LNK2038: mismatch detected for ‘RuntimeLibrary’: value ‘MDd_DynamicDebug’ doesn’t match value ‘MD_DynamicRelease’ in Engine.h.obj

The weird thing is that it says MDd_DynamicDebug even when I set it to Release DLL. When I change it to Release Static, it changes to MDd_StaticDebug.

Any suggestion why it sticks to the debug version although I tell it to use the release one?

Is it correct that Engine (Debug Editor) compiles against the Release version?

The Development Editor build works fine.

Okay I found the solution. You have to remove the _DEBUG preprocessor symbol as well when switching to Release.