Configuration file.

  • Thread starter Thread starter Meghansh
  • Start date Start date
M

Meghansh

Hello all,
I've an assembly a.exe which has a configuration file
a.exe.config. Now this assemblly loads a class from
another assembly b.dll. Can I've a configuration file for
this assembly, that is something like b.dll.config? This
way I'll be able to separate configuration for different
files.
I tried this, but this newer class tries to find its
appsettings from a.exe.config, and gives error if it is
not found.
Thanx in advance.
Meghansh.
 
Hi

The only way you can do it is by Creating a New
AppDomain, Set the AppBase for it to the b.dll(2nd
assembly) location and run the b.dll in that AppDomain

You cannot change the config location inside a current
appdomain once it is loaded and configured!!!

if you have any doubts/quries do get back

hth

regards,

sr
 
Meghansh, No you can't. AppSettings gets it settings from the Starting
assembly, in this case, a.exe.
 
Have a look at the .NET resources on the www.develop.com site. One of the
staff has written a library called AssemblySettings that lets you use
per-assembly
config settings.

--pat
 
I've an assembly a.exe which has a configuration file
a.exe.config. Now this assemblly loads a class from
another assembly b.dll. Can I've a configuration file for
this assembly, that is something like b.dll.config?

Out of the box, you can't do this - the built-in configuration classes
are *NOT* intended to be used for assembly / DLL config files -
there's no such thing.

Which is really stupid, in a way - I might implement a DLL which has
quite a bit of functionality, and I'd really like to add a config file
to that assembly, right?

Well, there's help in the form of third-party components, such as:

http://www.codeproject.com/csharp/Custom_Config_File_Reader.asp

Marc
================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Back
Top