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 ?

Answers


  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.

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


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


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


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


Need Your Help

Is there an arraylist in Javascript?

javascript

I have a bunch of things I want to add into an array, and I don't know what the size of the array will be beforehand. Can I do something similar to the c# arraylist in javascript, and do myArray.Add(

How to compare only Date without Time in DateTime types in Linq to SQL with Entity Framework?

c# .net database entity-framework linq-to-sql

Is there a way to compare 2 DateTime variables in Linq2Sql but to disregard the Time part.