Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Components and Config Files

I am developing a component in VB.NET- to be provided to users as a  DLL called blah.dll. There are a number of different parameters I would like to store in a config file.

within the code of blah.dll ther a re a number of thing that look like this

dim blahParam as string = ConfigurationSettings.AppSettings("blahParam")

I would have expected that blah.dll would look in the directory it is installed in for a file called blah.dll.config However, this is not the case.

blah.dll is pulling the values out of the config file of the exe that is consuming the dll - say consume.exe.config

Perhaps I am missing something, but this strikes me as problematic. Main 2 main issues are:

1) You can't simply xcopy deploy the .dll, you now have to manually add the appropriate entries into the <appSettings> section of consume.exe.config

2) There is potential for collision between my blahParam appsetting and that of another vendors - that is, the benefit of namespaces does not extend here - though I could call the thing nickBlahParam and hope that no one else would come up with that.

Please let me know if I am missing something or just put in your 2 cents.


Also - for those of you interested in public, collaborative development of .NET software (not Open Source ... you know what I mean) please post to my earlier thread called "GotDotNet Workspaces - SorceForge-like... "

nick katsivelos
Wednesday, September 25, 2002

No, you're not missing anything.  The .NET runtime does not support configuration files for DLL's.  However, here's a sample that shows you how to overcome this with a special class that will parse a config file for you:

Patrick Steele
Wednesday, September 25, 2002


Thanks for that tip.

Now if I include the Exception Handling Application Block and this thing into my project, the code I actually wrote will be dwarfed by all the other stuff ;)

Thanks again

nick katsivelos
Wednesday, September 25, 2002

That reminds me, once to amuse myself I was trying to think of what the smallest possible Windows application would be.

I came up with several:

* Light.EXE. Turns every pixel on your screen white. Used when you need more light in the room and you're not using your computer.

* Dark.EXE. Turns every pixel black. Used when you want your computer to be on but not LOOK on.

* Nightlight.EXE. Turns every pixel pastel green. Used to cast a dim glow so you can find the bathroom at night without tripping.

The EXE's could easily come in at 2K or so, maybe 4K at the most. Then you'd have Setup, Uninstall, a web site to download it, a tech support forum, autoupdate, autorepair, help file, documentation, license management, crash detection and reporting, SNMP MIBs, etc., for a total ratio of 99% "extra crap" to 1% "useful code."

I would sell each app for $99, the full suite could be $279.

Joel Spolsky
Thursday, September 26, 2002

And if you did them with .NET, they'd take like 20MB of RAM....\

Michael Giagnocavo
Friday, September 27, 2002

*  Recent Topics

*  Fog Creek Home