locked
Change the way configuration file is loaded? RRS feed

  • Question

  • Hi,

    We have an application "App1" written in C# that is invoked from another process "Process1" written in VB6 using "CreateObject". In "App1" we raise some dialog that must be modal with respect to "Process1". That is why we use "CreateObject".

    To get access to configuration data that adheres to "App1" we need to have these within a "Process1.exe.config" file and it works. However we would really like to have our application installed within its own directory and having its own configuration file. Is there any way to do this? The running process is "Process1" so I guess we have to break this in order to get it working? All ideas are more than welcome (no, a rewrite of that old VB& is not an option unfortunately).

    --
    Werner

    Monday, February 15, 2010 3:41 PM

Answers

All replies

  • The configuration file must be named according to the executable.

    There are some (very limited) ways to split up the configuration file so that Process1.exe.config could include settings from another XML file by reference.

    In general, there is configSource which takes the entire section from an external file:

    http://weblogs.asp.net/fmarguerie/archive/2007/04/26/using-configsource-to-split-configuration-files.aspx

    For appSettings specifically, there is the file= attribute which merges the settings in the config file with the appSettings in an external file:

    http://weblogs.asp.net/pwilson/archive/2003/04/09/5261.aspx

    (You might consider creating your own XML file for your settings and access it through the normal System.Xml APIs.  I'm sure this is not what you wanted to hear...)


    Tuesday, February 16, 2010 12:26 AM
  • Thanks BinaryCoder, unfortunately you confirmed what I could Google :(. I was hoping that it was possible to leave the binding to the running process - 100%.

    Tuesday, February 16, 2010 7:16 AM
  • @ Karel Zikmund && SamAgain:

    Whats up with that "marking answers"? Please give it a rest and let the thread starter mark whatever actually did answer his/hers questions.
    Tuesday, February 16, 2010 7:18 AM