Why don't you rename your cMyConfigFile.config file as a first step of your
application. The reason why you would need a different name (I presume) is
to be able to switch from one config file to the other just by restarting
your service with a different start-up parameter. You could have

cMyConfigFile1.config
cMyConfigFile2.config
cMyConfigFile3.config

and every time you restart your service, copy the config file that you
passed in as a start-up parameter and create myapp.exe.config file
(overwrite the existing file, if any). This way you will always have your
different config files and your assemblies will not need any changes.
Am I missing something?

Regards,
Eddie

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Georg Jansen
Sent: Saturday, December 30, 2006 3:51 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] Configuration file name as a start up
parameter


Hi,

I have an application where I need to provide the name of the configuration
file as a start up parameter (for example myapp.exe -cMyConfigFile). The
application is started as a windows service.

The application uses other assemblies that use the "standard"
System.Configuration.ConfigurationManager.AppSettings["MySetting"], to
retrieve settings from the config file, and it would be best if I did not
need to rewrite those assemblies.

So what I need is some kind of method to specify a different application
config file, and have the framework read from that file instead of the
standard "myapp.exe.config".

I have been struggling with this for a while, and any help would be
appreciated!


Best regards
Georg

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to