Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# DLLs reading Config file

Status
Not open for further replies.

IAdams

MIS
Jul 9, 2008
11
US
To All:

I have written a DLL using C# that has a config file called <DLLName>.dll.config. The trouble is, the DLL's config file never seems to be read unless I open the code, go to the tab that defines the config, change the value and rebuild. It seems it only exists in code?

I also have an EXE with a config that works fine and re-reads automatically at startup. Also I can refresh it anytime during execution. This is exactly what I want.

I guess EXE and DLL's config work differently but what's the rule?

Thanks!
 
the later config file is read automatically because that is the executing assembly, so it looks for an associated config file. if you place the configs from <DLLName>.dll.config in the executing config file the setting will be read as you expect.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for your quick response.

Do you mean I should make the dll's config file a member of the EXE Assembly? Or that I should move the settings from the dll's config to the EXE's config?
 
the latter. move the settings from the dll's config to the EXE's config.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top