c# mono interop - Unrecognized configuration section dllmap

懵懂的女人 提交于 2020-01-06 02:35:24

问题


I understand: when I put dllmap into app.config so that mono can find the linux flavor of the native dll, I upset the windows based configuration system as there is no configuration section defined for it.

I can see I have some options:

  • add a dummy section for it - this would fail for multiple dllmap elements so I don't think that is the answer
  • bother with different configurations per platform - I'd rather avoid that extra work

So question is, how do you silence the error on windows?

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
    </startup>
    <dllmap dll="winscard" target="libpcsclite.so.1"/>
</configuration>

Error:

Configuration system failed to initialize

Unrecognized configuration section dllmap. (...exe.Config line 6)


回答1:


Great so someone else has asked this before, but not helpful for me.

I figured, if the interop part is moved to a separate assembly file, (other than the exe) then we can have a config file specifically for that dll (your.dll.config) which will be ignored by MS framework, but parsed by mono. Effectively, this solves my problem. I'm not sure if it's the best solution, but it is acceptable.

Running:

MONO_LOG_LEVEL=debug mono my.exe

was very helpful as it shows what mono is looking at/for while loading libraries so I saw it was looking for a dll.config.



来源:https://stackoverflow.com/questions/36944460/c-sharp-mono-interop-unrecognized-configuration-section-dllmap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!