Config File For an Assembly?

C

C Newby

I'm building an assembly in which it would be helpful to store some settings
in an easy to edit text file. As of now, i added an application
configuration file in VS.NET, but the ConfigurationSettings.AppSettings
never has my settings in it. My config file basically looks like :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="setting1" value="setting1Value" />
</appSettings>
</configuration>

I tried copying the app.config file to the same directory as the compiled
assembly, and i also tried renameing it to MyApp.dll.config. None of these
worked though.

So...perhaps there is some other way i should be doing this?

Any advice is apreciated. TIA//
 
P

Patrick Steele [MVP]

I'm building an assembly in which it would be helpful to store some settings
in an easy to edit text file. As of now, i added an application
configuration file in VS.NET, but the ConfigurationSettings.AppSettings
never has my settings in it. My config file basically looks like :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="setting1" value="setting1Value" />
</appSettings>
</configuration>

I tried copying the app.config file to the same directory as the compiled
assembly, and i also tried renameing it to MyApp.dll.config. None of these
worked though.

Config files are only for executables, not dll's. There is a free piece
of code that shows how each DLL can have it's own config settings file.
See:

http://staff.develop.com/woodring/dotnet/#AssemblySettings
 

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