Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Configuration Files Location Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthias S. - 19 Mar 2008 14:28 GMT
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.

--
Peter Bromberg [C# MVP] - 19 Mar 2008 14:35 GMT
".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

> hi there,
>
[quoted text clipped - 20 lines]
> thanks for reading thus far. i hope i explained the problem properly.
> my english is not the best. any help is greatly appreciated.
Matthias S. - 19 Mar 2008 14:39 GMT
thanks for your reply. so I'll got to roll my own ;)
Signature


> ".dll" assemblies do not normally read a configuration file. You
> should put your settings in a config file named
[quoted text clipped - 30 lines]
> > properly.  my english is not the best. any help is greatly
> > appreciated.
TAB - 19 Mar 2008 16:47 GMT
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.

> thanks for your reply. so I'll got to roll my own ;)
>
[quoted text clipped - 32 lines]
>> > properly.  my english is not the best. any help is greatly
>> > appreciated.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.