C#类库中的App.config [英] App.config in a C# Class Library
问题描述
App.config
App.config in a C# Class Library
我有一个包含以下App.config文件的类库.
I have a class library that has the following App.config file in it.
----------------------------------------------- --------------------------------
-------------------------------------------------------------------------------
----------------------------------------------- --------------------------------
-------------------------------------------------------------------------------
问题是,当我尝试获取eventLogName键值时,我的类对象如下:
Problem is, that when I attempt to get the eventLogName key value my class object like this:
----------------------------------------------- --------------------------------
-------------------------------------------------------------------------------
ConfigurationSettings.AppSettings ["eventLogName"].ToString()
ConfigurationSettings.AppSettings["eventLogName"].ToString()
----------------------------------------------- --------------------------------
-------------------------------------------------------------------------------
它根本看不到appSettings具有任何键.
It doesn't see the appSettings as having any keys at all.
我看到connectionStrings键,而没有看到appSettings键
I see the connectionStrings key, just not the appSettings key
怪异....
谢谢
怀疑
推荐答案
请删除元素< clear/> ;,该元素指示配置管理器清除以前的配置设置.
希望这会有所帮助.
欢呼声
这篇关于C#类库中的App.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!