Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In a VS2005 C# project I have added a reference to System.configuration. In the object browser, I can see the System.Configuration.ConfigurationManager. In Intellisense System.Configuration only has the old ConfigurationSettings, and not ConfigurationManager.

My code System.Configuration.ConfigurationManager.AppSettings["MySetting"]

is highlighted as a syntax error and does not compile.

In a different project, the exact same setup works just fine... any clues as to what is going on?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
434 views
Welcome To Ask or Share your Answers For Others

1 Answer

Although the using System.Configuration; command is automatically generated in the using section, for some reason the actual reference is not set.

Go into add reference, .Net tab, and choose System.Configuration.

ConfigurationManager will now be resolved.

If you go to the project where the exact same setup works just fine and look at the references, you will see a reference to System.Configuration.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...