Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ConfigurationManager-如何在.NET 3.5中使用连接字符串?_C#_.net_Configuration_Connection String - Fatal编程技术网

C# ConfigurationManager-如何在.NET 3.5中使用连接字符串?

C# ConfigurationManager-如何在.NET 3.5中使用连接字符串?,c#,.net,configuration,connection-string,C#,.net,Configuration,Connection String,我在这里看到一篇关于我想做什么的很好的帖子 它说使用ConfigurationManager类。我无法引用ConfigurationManager类 如果查看我正在使用的system.dll(v2.0.50727),则没有ConfigurationManager类 我正在使用VS2008,我的项目将编译为.NET3.5 如果我这样做 string test = System.Configuration.ConfigurationManager.AppSettings["test"]; 我收到

我在这里看到一篇关于我想做什么的很好的帖子

它说使用ConfigurationManager类。我无法引用ConfigurationManager类

如果查看我正在使用的system.dll(v2.0.50727),则没有ConfigurationManager类

我正在使用VS2008,我的项目将编译为.NET3.5

如果我这样做

string test = System.Configuration.ConfigurationManager.AppSettings["test"];
我收到消息“Error 182命名空间“System.Configuration”中不存在类型或命名空间名称“ConfigurationManager”(是否缺少程序集引用?)


有什么想法吗?

配置管理器
系统配置
命名空间的一部分。默认情况下,它不会在项目中引用,因此请从GAC添加对if的引用。

您已经引用了“system.configuration.dll”


只需在参考文件夹的VS中单击鼠标右键,然后搜索此dll

是否已添加对System.Configuration的参考?对。我以为我有,但我在“System”dll中引用了名称空间“System.Configuration”,如上所述,我在“System”dll中引用了名称空间“System.Configuration”