app.config not recognized by Visual Studio .Net

T

Thomas Locke

Hi,

I have a class library project with an app.config file in it.
Everything I have read indicates that VS.Net will copy and rename the
app.config file into the bin/ directory when I build the project.

But all the examples show the project as having myapp.exe and that
creates myapp.exe.config.

However, my project simply produces a myapp.dll file. I can't find any
documentation to support this, but I would think that VS.Net would
create myapp.dll.config based on my app.config file.

But that's not happening. I tried to manually copy the app.config file
and rename it in the /bin directory, but any call to
AppSettings("key") doesn't return a value. It doesn't throw an error,
but it just doesn't return anything.

Any ideas?

Thanks!
--Kevin
 
M

Marc Scheuner [MVP ADSI]

I have a class library project with an app.config file in it.
Everything I have read indicates that VS.Net will copy and rename the
app.config file into the bin/ directory when I build the project.

Yes - if your project were a EXE - it won't work for class libraries
(which result in DLLs) - sorry !

For handling DLL assemblies, you'll need to resort to a third-party
config file component to handle this situation, 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
 

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