得到错误"“配置”这个名字并不在目前的情况下存在 [英] Getting error "The name 'Configuration' does not exist in the current context

查看:180
本文介绍了得到错误"“配置”这个名字并不在目前的情况下存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visual Studio 2013与.NET框架4.5。

I am using Visual Studio 2013 with .NET Framework 4.5.

我已经包括 System.Configuration 。作为项目的引用

I have included the System.Configuration as a reference in the project.

我也包括using语句在类如:

I have also included a using statement in the class as such:

using System.Configuration;



但是,下面的行仍然给我上述问题的错误。我该如何摆脱错误的?用

However, the following line still gives me the above subject error. How do I get rid of the error?

using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["WarrantySqlConnection"].ToString()))

编译时错误是在 ConfigurationManager中字。

推荐答案

尝试删除并参考重新添加到组装系统.Configuration.dll ,通过引用右击,选择添加引用,然后找到 System.Configuration
后添加引用的DLL,如果你有问题,还是保存并关闭Visual Studio和重新启动它。

Try remove and re-add the reference to the assembly System.Configuration.dll , by right-clicking on the References, choose add reference and then find System.Configuration. After you add a reference to the dll if you have still problem save and close your Visual Studio and restart it.

这篇关于得到错误"“配置”这个名字并不在目前的情况下存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆