Monday 28 July 2008

ConfigurationManager not recognized in console application

So you follow best practice advice and store your database connection string in your console applications app.config file. Good so far, except when you try to access the setting in code you get ConfigurationManager not recognized!

Solution Add a reference to System.ConfigurationManager in your project references.

E.g.

Public ReadOnly Property conString() As String
Get
Return ConfigurationManager.ConnectionStrings("your connection string Name").ConnectionString
End Get
End Property

No comments: