How can I specify one .config file for multiple EXE projects in .NET.

I have a project that I am splitting into multiple .exe projects. I am still planning to post them using once, once, to the same location at the same time, and I would like to use the same config file.

I added app.config

to each project using the Add Reference option in Visual Studio, which is great for debugging, but in production when I compile each project's exe, it is app.config

not copied to the bin folder of the main project.

Example:

master.exe

from master.exe.config

master.exe

can launch order.exe

based on user settings master.exe

can launch returns.exe

based on user settings

master, order and returns will be in the same folder and must share the same config file.

+2


a source to share


2 answers


You can't, and not with the default CLR host. You can write your own host that uses a different AppDomainSetup.ConfigurationFile to initialize the main AppDomain. But you certainly don't want this to continue, C ++ and COM skills are required.



Using a lot of EXEs is pretty unusual. The most that an EXE can do is Thread. Apart from preventing the main application from crashing when it crashes with an unhandled exception. Filling the configuration in a separate XML file is probably the fastest solution.

0


a source


I would suggest that if you want to do this, it's better to just read / write to the config file via regular XML classes.



+1


a source







All Articles