在VS 2003转换2005时,项目里会出现原来2003里过时的配置文件引用的类,如下:
System.Configuration.ConfigurationSettings.AppSettings 已过时 警告:"System.Configuration.ConfigurationSettings.AppSettings”已过时:“This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings”
注意:默认没有引用ConfigurationManager类,所以找不到System.Configuration命名空间的 ConfigurationManager类。
解决:
首先,添加对System.Configuration.dll 文件的引用;
其次,再将"System.Configuration.ConfigurationSettings.GetConfig替换为System.Configuration.ConfigurationManager.GetSection;
最后,将“System.Configuration.ConfigurationSettings.AppSettings”替换为System.Configuration.ConfigurationManager.AppSettings”。