Hatem
Hatem

Reputation: 589

ConfigurationManager Class not exist on .NET 4.5 Framework

I just start working with .NET Framework 4.5 of C#. Am using Windows Form Application. I have do the needed imports such as :

using System.Configuration;

But actually the ConfigurationManager class seems that it is not exits. I have tried to use ConfigurationSettings instead , but Visual Stdio telling me that it is obsolete and replaced by ConfigurationManager !

This is chunk of code related to the problem :

Int32.Parse StartingMonth = int.parse(ConfigurationManager.AppSettings["StartingMonthColumn"]);

So , could you please help me ?

Upvotes: 34

Views: 70387

Answers (5)

Chamath Viduranga
Chamath Viduranga

Reputation: 145

If you are unable to find the reference here is the correct path

"C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a"

Go to the Add reference and select the browser option and go to the above link. Then you can add the System.Configuration.dll

Upvotes: 0

Shalom Segev
Shalom Segev

Reputation: 251

RightClick on project -> Add-> Reference...-> Assemblies-> Framework Select the System.Configuration (checked) Should solve the problem.

Upvotes: 25

Ramendra
Ramendra

Reputation: 51

ConfigurationManager is present in System.Configuration namespace but it need System.Configuration assembly in your project.

Upvotes: 5

Hatem
Hatem

Reputation: 589

It is because of reference , I just restarted the project after adding the reference and it is working OK :)

Upvotes: 3

Ekk
Ekk

Reputation: 5715

  1. Make sure that you add System.Configuration.dll to the project. If you already added it, try to remove and add it again.
  2. Put the cursor on ConfigurationManager then press ctrl+., and see what it suggests you.

Upvotes: 59

Related Questions