Sharing config file between two exes?

  • Thread starter Thread starter Jonny
  • Start date Start date
J

Jonny

Hi,
I have two exe-files, named Test1.exe and Test2.exe that are located in the
same directory. Now I want these two exe to share the same config file. Can
this be done?

Since I created Test1.exe first, I have a file named Test1.exe.config. Can
this be used by Test2.exe?

Thanks,

Mats-Lennart
 
I'm not aware if it's only possible to point out other config file (seems
that it isn't possible), but you can set the postbuild event in VS to make a
copy of existed config with new name.
Hi,
I have two exe-files, named Test1.exe and Test2.exe that are located in the
same directory. Now I want these two exe to share the same config file. Can
this be done?

Since I created Test1.exe first, I have a file named Test1.exe.config. Can
this be used by Test2.exe?

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Adding to my previos post, you certainly can use System.Xml namespace to read
that config file

Jonny said:
Hi,
I have two exe-files, named Test1.exe and Test2.exe that are located in the
same directory. Now I want these two exe to share the same config file. Can
this be done?

Since I created Test1.exe first, I have a file named Test1.exe.config. Can
this be used by Test2.exe?

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
you can share single .config file between two applications but not that
easy.
you must write custom code to read properties

You can use System.Xml namespace as Michael Nemtsev wrote

hope ths helps
Galin Iliev[MCSD.NET]
www.galcho.com
 
The AppDomain class has a ConfigFileName property but then you would need to
get into custom code to load the assembly and so on.

The default behavior for an exe is to load a config file with the same name
as the executable plus ".config"
Peter
 
Back
Top