【发布时间】:2011-03-22 10:54:08
【问题描述】:
我在这里看到一篇关于我想做的非常好的帖子,
.net 3.5: To read connectionstring from app.config?
它说要使用 ConfigurationManager 类。我无法引用 ConfigurationManager 类。
如果我查看我正在使用的 system.dll(即 v2.0.50727),则没有 ConfigurationManager 类。
我使用的是 VS 2008,我的项目设置为编译为 .NET 3.5。
如果我这样做,
string test = System.Configuration.ConfigurationManager.AppSettings["test"];
我收到消息“错误 182 名称空间“System.Configuration”中不存在类型或名称空间名称“ConfigurationManager”(您是否缺少程序集引用?)”
有什么想法吗?
【问题讨论】:
-
是否添加了对 System.Configuration 的引用?
-
对。我以为我有,但我在“System”dll 中引用了命名空间“System.Configuration”
标签: c# .net configuration connection-string