无法在Xamarin中加载nlog.config [英] Cannot load nlog.config in Xamarin

查看:331
本文介绍了无法在Xamarin中加载nlog.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法读取android平台资产文件夹中的 nlog.config 文件

I cannot read nlog.config file in asset folder of android platform

NLog.LogManager.Configuration = new XmlLoggingConfiguration("NLog.config");

如何读取nlog文件,并且该文件也位于android资产中.

How to read nlog file and also this file is in android asset.

推荐答案

您也可以尝试使用此文件(带有构建操作的 nlog.config 文件作为AndroidAsset):

you could also try to use this (nlog.config file with a Build Action as an AndroidAsset):

NLog.LogManager.Configuration = new XmlLoggingConfiguration (XmlTextReader.Create(Assets.Open ("NLog.config")), null);

指的是: https://github.com/NLog/NLog/blob/master/src/NLog/Config/LoggingConfigurationFileLoader.cs#L101-L120

这篇关于无法在Xamarin中加载nlog.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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