Configuration Files Location Problem

M

Matthias S.

hi there,

i'm building a small class library which will be used from classic asp
(com interop), asp.net and for testing purposes from my console test
application. the class library requires an app.config which i have
created. a couple of settings are added to it.

now my problem: in my console test application i've added a reference
to the class library. everything works fine except that the class
library doesn't read the configuration settings as i would expect. the
values read using the ConfigurationManager.AppSettings["MySetting"]
method always return null strings. i've been working with app.config
files before and it always worked fine.

i guess this might have to do with the hierarchy of configuration
settings. i guess, if i would add the configuration file to the console
app instead of adding it to the class library, everything would work
fine. but this is not what i need. i need the configuration to be
attached to the class library. does this have anything to do with
installing the class library in the gac? do i need to do that? and if
so, how do i do that?

thanks for reading thus far. i hope i explained the problem properly.
my english is not the best. any help is greatly appreciated.

--
 
M

Matthias S.

thanks for your reply. so I'll got to roll my own ;)
--


".dll" assemblies do not normally read a configuration file. You
should put your settings in a config file named
<myExeName>.exe.config. The executable will then read your settings
which may easily be passed to the class library. -- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


Matthias S. said:
hi there,

i'm building a small class library which will be used from classic
asp (com interop), asp.net and for testing purposes from my console
test application. the class library requires an app.config which i
have created. a couple of settings are added to it.

now my problem: in my console test application i've added a
reference to the class library. everything works fine except that
the class library doesn't read the configuration settings as i
would expect. the values read using the
ConfigurationManager.AppSettings["MySetting"] method always return
null strings. i've been working with app.config files before and it
always worked fine.

i guess this might have to do with the hierarchy of configuration
settings. i guess, if i would add the configuration file to the
console app instead of adding it to the class library, everything
would work fine. but this is not what i need. i need the
configuration to be attached to the class library. does this have
anything to do with installing the class library in the gac? do i
need to do that? and if so, how do i do that?

thanks for reading thus far. i hope i explained the problem
properly. my english is not the best. any help is greatly
appreciated.
 
T

TAB

I am using Properties.Settings.Default.xxxx for my settings in a class
library without problems.
They are saved in its own app.config as usual, different directory than the
application though.


Matthias S. said:
thanks for your reply. so I'll got to roll my own ;)
--


".dll" assemblies do not normally read a configuration file. You
should put your settings in a config file named
<myExeName>.exe.config. The executable will then read your settings
which may easily be passed to the class library. -- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


Matthias S. said:
hi there,

i'm building a small class library which will be used from classic
asp (com interop), asp.net and for testing purposes from my console
test application. the class library requires an app.config which i
have created. a couple of settings are added to it.

now my problem: in my console test application i've added a
reference to the class library. everything works fine except that
the class library doesn't read the configuration settings as i
would expect. the values read using the
ConfigurationManager.AppSettings["MySetting"] method always return
null strings. i've been working with app.config files before and it
always worked fine.

i guess this might have to do with the hierarchy of configuration
settings. i guess, if i would add the configuration file to the
console app instead of adding it to the class library, everything
would work fine. but this is not what i need. i need the
configuration to be attached to the class library. does this have
anything to do with installing the class library in the gac? do i
need to do that? and if so, how do i do that?

thanks for reading thus far. i hope i explained the problem
properly. my english is not the best. any help is greatly
appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top