Unable to use C# ConfigurationManager

Paul Michaels picture Paul Michaels · Oct 6, 2010 · Viewed 23.4k times · Source

I have the following code:

using System.Configuration;

namespace test
{
  public partial class MyService : ServiceBase
  {
    public  static ReadConnectionStrings()
    {                        
      ConnectionStringSettingsCollection connections =
          ConfigurationManager.ConnectionStrings;

However, it doesn’t recognise ConfigurationManager. I took this code directly from here

So I’m clearly missing something, but can’t identify what.

Answer

Steve Danner picture Steve Danner · Oct 6, 2010

Do you have a reference to System.Configuration? It's not added to .NET projects by default.