zoukankan      html  css  js  c++  java
  • System.Configuration.ConfigurationSettings.AppSettings已过时的解决办法

    在VS 2005中,经常会使用到ConfigurationSettings类来读取应用程序配置文件的信息,以获取数据库连接的字符串,但是,经常会出现如下的错误:

    警告“System.Configuration.ConfigurationSettings.GetConfig(string)”已过时:“This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.GetSection”

    警告   1 “System.Configuration.ConfigurationSettings.AppSettings”已过时:“This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings”


    解决方法:

    首先添加对System.Configuration.dll 文件的引用,既在该项目中添加引用,在浏览中找到System.Configuration.dll文件,一般该文件在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727文件夹中

    其次把.net 1.0下的System.Configuration.ConfigurationSettings.AppSettings索引器换成.net 2.0下的System.Configuration.ConfigurationManager.AppSettings索引器。

    把"System.Configuration.ConfigurationSettings.GetConfig换成System.Configuration.ConfigurationManager.GetSection

  • 相关阅读:
    属性注入(依赖注入)
    Spring之ioc
    Spring初始案例
    ::before和::after伪元素、:visited和:link、transform: scaleX(2);的使用
    给博客博文加上日期分类(set、map)
    Jquery父子选取心得
    先从css3开始拾起
    尝试博客文章一号
    Response.setContentType()
    pom配置详解
  • 原文地址:https://www.cnblogs.com/yuxuetaoxp/p/1845189.html
Copyright © 2011-2022 走看看