Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ConfigurationManager not declared - Have dll

Quick background: I have a VB.NET application in which I was previously using ConfigurationSettings.AppSettings to read from app.config, and got an error message to change it to System.Configuration.ConfigurationManager.AppSettings (as the first way is now obsolete)

I did so, and I even have a reference to System.Configuration.dll AND the Imports statement at the top, but I am getting a "Name ConfigurationManager not declared" error message. Any suggestions?

CODE: It's pretty straightforward - I'm just checking if something exists, and if it does, I read from it:

If Not Exists(ConfigurationManager.AppSettings.Get(rep & "Email")) Then
        Return False
End If

message = ReadAllText(ConfigurationManager.AppSettings.Get(rep & "Email"))
like image 780
dj18 Avatar asked Dec 17 '22 11:12

dj18


1 Answers

The project template doesn't have the reference you need. Project + Add Reference, select "System.Configuration".

For more insight, click the "Show All Files" icon at the top of the Solution Explorer window and open the References node.

like image 102
Hans Passant Avatar answered Jan 09 '23 09:01

Hans Passant