Config Files

S

Steve

Hi all

I am using App.Config files to store custom settings in the appSettings
section for my executable. This works fine, but I have another Assembly
which is a dll and I can't seem to get the dll to read from the config file.
Is it possible to do this?

I have placed the config file 'MyAssembly.dll.config' in the same folder as
the assembly itself, but when I step through the code it doesn't pick up the
values like my exe config file.

Any help is greatly appreciated,

Kind Regards,
Steve.
 
J

Jeff B.

I may be mistaken on this but I believe the config file applies to the EXE
only. Your DLL would look at the "appname.exe.config" file for its
information.
 
S

Steve Amey

Hi Jeff

Thanks for your reply. Guess I'll have to read a custom file as my DLL is a
..NET Remoting object on another machine and can't read the EXE config file.

Do you know if the DLL will always look at the exe config file if they are
on the same computer? So if the dll is in the GAC or elsewhere it will be
'aware' of the appSettings section in the appname.exe.config?

Cheers,
Steve.
 
J

Jeff B.

Do you know if the DLL will always look at the exe config file if they are
on the same computer? So if the dll is in the GAC or elsewhere it will be
'aware' of the appSettings section in the appname.exe.config?

That is my understanding. If someone else knows different, then please feel
free to correct me :)
 
B

Bennie Haelen

Hi Steve,

Config files are at an .exe level, not at an Assembly level, so you will not
be able to do what you want to do here.

You probably should think about creating a configuration section for
your assembly in your main exe's app.config file.

Regards,

Bennie Haelen
 

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