C # prompt: context name "ConfigurationManager" there is no current

Scenes

App.config want to get content set in the program.

Want to pass

ConfigurationManager.AppSettings[key];

To obtain, has been added

using System.Configuration;

But still prompt "ConfigurationManager current context name does not exist"

 

 

achieve

In addition to adding using System.Configuration;

Also re-add a reference

Right-click References - Add --System.Configuration

 

 

Guess you like

Origin www.cnblogs.com/badaoliumangqizhi/p/12010598.html