ConfigurationManager的命名空间在哪里?

31 c# configurationmanager reference system.configuration .net-3.5

我有一个引用System.Configuration- 并且ConfigurationSettings发现没有问题 - 但找不到类型或命名空间ConfigurationManager!?

我已经阅读过 - 看起来它应该属于与ConfigurationSettings类相同的命名空间.

编辑:请注意 - 我已经清楚地说我添加了对System.Configuration的引用.已有4条关于此的评论.

小智 43

ConfigurationManager是.Net 2.0之后的System.Configuration的一部分.添加对System.Configuration dll的引用.尝试使用System.Configuration.ConfigurationManager.


S..*_*S.. 16

您需要使用System Configuration命名空间,这必须以两种方式包含:

  1. 右键单击项目并选择添加引用,浏览" 程序集"并勾选System.Configuration程序集.

  2. 在代码中包含命名空间:

    使用System.Configuration;

  • 使用"使用System.Configuration"对我来说不起作用.但是通过"右键单击>添加引用>程序集> System.Configuration"解决方案添加对我有用.谢谢. (3认同)

Bla*_*keH 5

您需要添加System.Configuration程序集的引用.此命名空间分为几个程序集.


小智 5

您需要在项目的Reference文件夹下添加System.Configuration引用.仅在类中使用using语句添加system.configuration是不够的.

  • 作者说:"我已经清楚地说过我已经添加了对System.Configuration`的引用.另外,这个问题还有两年多了,请下次再回答一个问题. (4认同)