console app with multiple configuration files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an app I run under the windows scheduler that makes use of the .config
file, and I use Configuration.AppSettings to interrogate it. I would like to
run it against more than 1 .config file, and the only way I can think to do
this (using Configuration.Appsettings) is to create a copy of the app on the
filesystem for each .config file. Obviously, not very elegant, but I dont
have the time to play with XML. Is it possible to do something like pass the
config file name in on the command line? Or does someone know of a cleaner
solution?
This using 1.1
Thanks, Mark
 
You'll either have to "play with XML," create your own custom config files
(in whatever format you like), use the System Registry, or use the .Net
Configuration model. Have you considered that you can host multiple
configurations in a single Configuration file, using custome Configuration
Sections? IOW, what makes you so sure you have to use multiple files?

The good news is, you have a lot of options!
--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
 
Create a DataSet qwith two columns key and value

Use the WriteXml and ReadXml features of the dataset to build/read the
config files, and DataTable.FindByKey() method it will generate to retrieve
a value...

Steve
 
Back
Top