Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

ConfigurationManager returns no settings

Avatar of MDKIMZEY
MDKIMZEYFlag for United States of America asked on
Visual Basic.NET
4 Comments1 Solution941 ViewsLast Modified:
I have a project for a DLL in a Visual Studio 2010 solution.  The project includes the System.Configuration reference and an app.Config with a connection strings section.  

<?xml version="1.0" encoding="utf-8" ?>
        <add name="MyConnectionString" 
            connectionString="Data Source=MyComputer\SQLEXPRESS;Initial Catalog=MyDb;Integrated Security=SSPI;"/>

The DLL builds successfully and places a DLLName.config file under the bin\Debug folder.

When I debug the code, ConfigurationManager returns a NameValueCollection with zero entries.

   Dim appSettings As Specialized.NameValueCollection = ConfigurationManager.AppSettings

Also, the code below returns an empty string:

  connString = ConfigurationManager.AppSettings( "MyConnectionString" )

Do I need to specifically instantiate the ConfigurationManager with the full path specification of the app.Config in the project?
Avatar of Craig Wagner
Craig WagnerFlag of United States of America imageSoftware Architect

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers