Unity 5.5x external dll issue on build after updade from 5.3.x

Hello Everyone and thank you for your time.
I’m facing an issue building (win x86) a specific project on Unity 5.5.0f3

Last Year using Unity 5.2.x I made some code for a project related for visually impaired persons. At that time I found a very interesting integration made by DaG_II here He used the external DLL Interop.SpeechLib.dll to make a unity project that can interact with windows SAPI 5.x

So I took his idea, I made better samples code about how to interact with windows SAPI and I shared the code and the build (made by Unity 5.2.x) here

Now, after Unity 5.4.0 release, the code keeps run, and so the dll but trying to build unity suddenly stop whit this error:

ReflectionTypeLoadException: The classes in the module cannot be loaded
System.Reflection.Assembly.GetTypes ()
(at
/Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/Assembly.cs:371)
UnityEditor.AttributeHelper+c__Iterator31[System.Collections.Generic.IEnumerable1[UnityEditorInternal.PluginDesc]].MoveNext
() (at
C:/buildslave/unity/build/Editor/Mono/AttributeHelper.cs:277)
UnityEditor.PluginImporter+c__Iterator0.MoveNext
() (at
C:/buildslave/unity/build/Editor/Mono/PluginImporter.cs:41)
DesktopStandalonePostProcessor.CopyNativePlugins
() (at
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:116)
DesktopStandalonePostProcessor.SetupStagingArea
() (at
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:145)
DesktopStandalonePostProcessor.PostProcess
() (at
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:23)
UnityEditor.WindowsStandalone.WindowsDesktopStandalonePostProcessor.PostProcess
(BuildPostProcessArgs args) (at
C:/buildslave/unity/build/PlatformDependent/WinPlayer/Extensions/Managed/WindowsDesktopStandalonePostProcessor.cs:118)
UnityEditor.PostprocessBuildPlayer.Postprocess
(BuildTarget target, System.String
installPath, System.String
companyName, System.String
productName, Int32 width, Int32
height, System.String
downloadWebplayerUrl, System.String
manualDownloadWebplayerUrl,
BuildOptions options,
UnityEditor.RuntimeClassRegistry
usedClassRegistry,
UnityEditor.BuildReporting.BuildReport
report) (at
C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:176)
UnityEditor.HostView:OnGUI()

The issue is related to the sapi dll, I awaited until unity 5.5 was released but it still not working, and I have not enought experience to figured out.

Thank you for any suggestion

Full LOG

Packing sprites: SpritePacker failed
to get types from Interop.SpeechLib,
Version=5.4.0.0, Culture=neutral,
PublicKeyToken=null. Error: The
classes in the module cannot be
loaded.
UnityEngine.DebugLogHandler:Internal_Log(LogType,
String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType,
Object, String, Object)
UnityEngine.Logger:Log(LogType,
Object) UnityEngine.Debug:Log(Object)
UnityEditor.Sprites.Packer:RegenerateList()
(at
C:\buildslave\unity\build\Editor\Mono\Sprites\SpritePacker.cs:74)
UnityEditor.Sprites.Packer:GetSelectedPolicyId()
(at
C:\buildslave\unity\build\Editor\Mono\Sprites\SpritePacker.cs:102)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String,
String, String, BuildTarget,
BuildOptions, Boolean)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean,
BuildOptions, Boolean) (at
C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:464)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean,
BuildOptions) (at
C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:321)
UnityEditor.BuildPlayerWindow:GUIBuildButtons(IBuildWindowExtension,
Boolean, Boolean, Boolean,
BuildPlatform) (at
C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:1364)
UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings()
(at
C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:1291)
UnityEditor.BuildPlayerWindow:OnGUI()
(at
C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:887)
System.Reflection.MonoMethod:InternalInvoke(Object,
Object, Exception&)
System.Reflection.MonoMethod:Invoke(Object,
BindingFlags, Binder, Object,
CultureInfo) (at
/Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object,
Object) (at
/Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String,
Object) (at
C:\buildslave\unity\build\Editor\Mono\HostView.cs:249)
UnityEditor.HostView:Invoke(String)
(at
C:\buildslave\unity\build\Editor\Mono\HostView.cs:242)
UnityEditor.HostView:OnGUI() (at
C:\buildslave\unity\build\Editor\Mono\HostView.cs:76)

(Filename:
/Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs
Line: 222)

  • Grouping sprites using the selected SpritePackerPolicy.
  • Packing 0 atlases.
  • Packing completed. Opening scene ‘Temp/__Backupscenes/0.backup’ Load
    scene ‘Temp/__Backupscenes/0.backup’
    time: 0.038916 ms Unloading 7 Unused
    Serialized files (Serialized files now
    loaded: 0) System memory in use
    before: 38.3 MB. System memory in use
    after: 38.4 MB.

See this answer.