开发者

ConfigurationManager not found

开发者 https://www.devze.com 2023-01-30 21:57 出处:网络
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 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:

开发者_如何学GoName ConfigurationManager is not declared

What am I missing?


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


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

ConfigurationManager not found


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


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...


Add the reference to System.Configuration:

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


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

now you can use "ConfigurationManager"

0

精彩评论

暂无评论...
验证码 换一张
取 消