I created a new windows service and attached a App.Config file to it. Then I went back to the code and tried this:
For some reason the compiler was not able to figure out the class and kept throwing an error. This does not happen with your standard EXE projects as well as ASP.NET projects. I also did not want to use the
ConfigurationSettings.GetConfig() method as it was obsolete. I fiddled around for a while and eventually ended up manually adding a reference to the
System.Configuration DLL. For those who don’t know, just right click on the References folder in your project, click on Add Reference. Select System.Configuration in the .NET tab and click OK. This should allow you to access the ConfigurationManager class. Back to work now..
I will some day write a post on how to implement custom configuration sections in the App.Config file.