c#mono interop - 无法识别的配置节dllmap [英] c# mono interop - Unrecognized configuration section dllmap

查看:824
本文介绍了c#mono interop - 无法识别的配置节dllmap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我明白:当我将 dllmap 添加到app.config中时所以mono可以找到本机dll的linux风味,我打乱了基于windows的配置系统,因为没有为它定义配置节。

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:


  • 它 - 这将失败多个dllmap元素,所以我不认为这是答案

  • 麻烦与不同的配置每个平台 - 我宁愿避免额外的工作

那么问题是,如何在Windows上消除错误?

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>

错误:


配置系统无法初始化

Configuration system failed to initialize

无法识别的配置部分dllmap。 (... exe.Config line 6)

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


推荐答案

http://stackoverflow.com/questions/967456/app-config-dllmap-entry-portability\">其他人在此之前已询问过,但对我没有帮助。

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

我想,如果interop部分被移动到一个单独的程序集文件(除了exe),那么我们可以有一个配置文件专门为该dll(your.dll.config),这将被MS忽略框架,但由单调解析。实际上,这解决了我的问题。

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.

运行:

MONO_LOG_LEVEL=debug mono my.exe

mono正在查看/ for在加载库,所以我看到它在寻找一个dll.config。

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.

这篇关于c#mono interop - 无法识别的配置节dllmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆