【发布时间】:2011-08-03 13:07:48
【问题描述】:
我在我的库项目中使用了一个配置文件,以便将接口与它们自己的类相关联;我遇到了麻烦,因为我的应用程序无法从配置中加载任何内容。这是配置文件中的一个示例,名为 app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Sic2Lib.it.carrefour.sic.profiler.datasource.def.AuthenticateDS" value="Sic2Lib.it.carrefour.sic.profiler.datasource.impl.AuthenticateDSImpl"/>
<add key="Sic2Lib.it.carrefour.sic.profiler.datasource.def.CheckUserDS" value="Sic2Lib.it.carrefour.sic.profiler.datasource.impl.CheckUserDSImpl"/>
<add key="Sic2Lib.it.carrefour.sic.profiler.datasource.def.ReadApplicationConfigDS" value="Sic2Lib.it.carrefour.sic.profiler.datasource.impl.ReadApplicationConfigDSImpl"/>
它保存在 DataSourceFactory 类的同一目录中。这个类应该通过命令来设置
NameValueCollection keys = ConfigurationManager.AppSettings;
因此,我构建了没有错误的项目,并且在 bin/Debug 文件夹中获得了一个名为 myProject.dll.confing 的文件。但毕竟这一切我总是把键变量弄空......怎么会?到目前为止我所做的有什么问题?
【问题讨论】:
标签: c# interface settings config