Home All Groups Group Topic Archive Search About

console app with multiple configuration files

Author
3 Mar 2006 3:59 PM
MarkAurit
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

Author
3 Mar 2006 5:26 PM
Kevin Spencer
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.

Show quote
"MarkAurit" <MarkAu***@discussions.microsoft.com> wrote in message
news:B50D81E9-8569-4AC8-A2BB-DC57796232C8@microsoft.com...
>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
Author
3 Mar 2006 5:28 PM
Steve B.
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

"MarkAurit" <MarkAu***@discussions.microsoft.com> a écrit dans le message de
news: B50D81E9-8569-4AC8-A2BB-DC5779623***@microsoft.com...
Show quote
>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

AddThis Social Bookmark Button