DeveloperM
DeveloperM

Reputation: 1239

ConfigurationManager not found

I am new to VS 3.5 and I am writing a console app that needs to pull some key values from the app.config file.

I have:

Imports System.Configuration 

and I am trying to reference ConfigurationManager.AppSettings but this generates an error:

Name ConfigurationManager is not declared

What am I missing?

Upvotes: 42

Views: 62518

Answers (6)

MTMDev
MTMDev

Reputation: 210

I had to Install NuGet package System.Configuration.ConfigurationManager in my Visual Studio 2019 C# project.

E.g.,

Install-Package System.Configuration.ConfigurationManager -Version 4.7.0

Upvotes: 16

GorvGoyl
GorvGoyl

Reputation: 49150

Project -> Add References -> .NET -> select System.Configuration

Project -> Add References -> .NET -> select System.Configuration

Upvotes: 28

Harsha
Harsha

Reputation: 49

Try using System.Configuration;
OR
Try to add reference by selecting
Project -> Add References -> .NET -> select System.Configuration

now you can use "ConfigurationManager"

Upvotes: 2

Tim
Tim

Reputation: 4101

I had this problem myself and actually included the reference to System.Configuration, and it STILL wouldn't show up.

I had to go to the Build menu, select Clean, and then rebuild.

Posting because in six months when I see this again I'll probably forget what I did...

Upvotes: 11

Qsiris
Qsiris

Reputation: 1183

Add the reference to System.Configuration:

Menu Bar -> Project -> Add Reference... -> .NET (Tab) -> System.Configuration -> OK

Upvotes: 0

Philip Fourie
Philip Fourie

Reputation: 116827

Make sure you have a reference to the assembly System.Configuration.dll

Upvotes: 100

Related Questions