It sounds like you are getting a reported hot reload failure in Visual Studio even though the hot reload is successful in the editor, is that correct? If this is the case, this is a known issue that you can find here: Unreal Engine Issues and Bug Tracker (UE-42205) . As shown in the report, we hope to have this fixed for 4.16.2. Something that may help would be to compile the code with the editor closed. Compiling without preforming a hot reload should clear out old .dll files that may be causing the conflict.
i found that UBT trying to create .lib with wrong ID:
2>[3/4] Link UE4Editor-MyProject2-8924.dll
2>[4/4] Link UE4Editor-MyProject2-4435.lib
2> Creating library Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject2-8924.suppressed.lib and object Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject2-8924.suppressed.exp
2> Creating library Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject2-8924.lib and object Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject2-8924.exp
2>ERROR : UBT error : Failed to produce item: Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject2-4435.lib
at begin it creates new libs with ID = 8924, but error is about creating “strange” lib with ID = 4435 which is unused by editor, because new lib with ID = 8924 is successfully hot-reloaded.
Editor log:
LogHotReload: New module detected: UE4Editor-MyProject2-8924.dll
LogHotReload: Starting Hot-Reload from IDE
LogClass: MyStruct2 HotReload.
LogContentBrowser: Native class hierarchy updated for ‘MyProject2’ in 0.0013 seconds. Added 2 classes and 2 folders.