F
Fernando Chilvarguer
Hello!
I created a Class Library project in VS2005. Then, using VS, I was able to
add a connection string to the project settings, which automaticaly created
an app.config file for me.
If I try to access the configuration using
System.Configuration.ConfigurationManager, I get a NullException.
The code:
string connectionString =
ConfigurationManager.ConnectionStrings["myConnectionName"].ConnectionString;
After that, I created a Windows Application Project and went through the
same steps and it worked, with a little twist: When I debug the application
it seems that the ConfigurationManager finds TWO connection strings, the one
that I create and one called "LocalSqlServer", which I have no idea where
it's located since it's not into the app.config file.
My questions:
1. Is it correct to assume that Class Libraries do not work with app.config
files on their own? If so, why would VS2005 allow for the creation of the
same.
2. Does the configuration manager automaticaly read configuration info from
any other file? (Where a "LocalSqkConnection" would be).
Thanks,
Fernando
I created a Class Library project in VS2005. Then, using VS, I was able to
add a connection string to the project settings, which automaticaly created
an app.config file for me.
If I try to access the configuration using
System.Configuration.ConfigurationManager, I get a NullException.
The code:
string connectionString =
ConfigurationManager.ConnectionStrings["myConnectionName"].ConnectionString;
After that, I created a Windows Application Project and went through the
same steps and it worked, with a little twist: When I debug the application
it seems that the ConfigurationManager finds TWO connection strings, the one
that I create and one called "LocalSqlServer", which I have no idea where
it's located since it's not into the app.config file.
My questions:
1. Is it correct to assume that Class Libraries do not work with app.config
files on their own? If so, why would VS2005 allow for the creation of the
same.
2. Does the configuration manager automaticaly read configuration info from
any other file? (Where a "LocalSqkConnection" would be).
Thanks,
Fernando