Getting error “The name 'Configuration' does not exist in the current context”

一笑奈何 提交于 2020-01-03 13:05:21

问题


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

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

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()))

The compile time error is on the ConfigurationManager word.


回答1:


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.



来源:https://stackoverflow.com/questions/32121383/getting-error-the-name-configuration-does-not-exist-in-the-current-context

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!