Looking for ConfigurationManager?

Date Published: 26 August 2005

Looking for ConfigurationManager?

In .NET 2.0 there is a new configuration class called

ConfigurationManager. It supercedes the ConfigurationSettings class that

most .NET developers are familiar with today. When you create a website in

VS2005 the ConfigurationManager class should be available because by default the

necessary reference is included in the websiteโ€™s compile settings.

However, other types of projects donโ€™t have this reference, to

System.Configuration (the assembly, not the namespace), by default. As a

result, you may have, for instance, a Console Application in which you are

typing System.Configuration. and hoping to find ConfigurationManager in the

resulting Intellisense dialog, but itโ€™s not present. The solution is to

remember that you need to manually go to the project, click Add Reference, and

scroll down within the .NET tab until you find System.Configuration. Once

this reference is added, System.Configuration.ConfigurationManager (and many

other classes) will once more be available to you.

Steve Smith

About Ardalis

Software Architect

Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.