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:
开发者_如何学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
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"
精彩评论