How can I specify a single .config file for multiple EXE projects in .NET
I have a project that I am breaking up into multiple .exe projects. I still plan on publishing them, using click once, into the same location at the same time, and I would like to use the same config file.
I have added the app.config
to each project using the "Add link" option in Visual Studio, which is great for debugging, but in production, when I compile each exe project, the app.config
is not copied into the "master project"'s bin folder.
example:
master.exe
with master.exe.config
master.exe开发者_如何学Go
may launch order.exe
based on user settings
master.exe
may launch returns.exe
based on user settings
master, order, and returns will all reside in the same folder, and should share a single config file.
I'd suggest that if you want to do this it might be better to just read/write to the config file via the normal XML classes.
You can't, not with the default CLR host. You could write a custom host that uses a different AppDomainSetup.ConfigurationFile to initialize the primary AppDomain. But you'd surely don't want that pursue that, C++ and COM skillz required.
Using a lot of EXEs is pretty unusual. Most anything a EXE can do, a Thread can do as well. Other than preventing the main app from going down when it crashes with an unhandled exception. Stuffing the config in a separate xml file is probably the quickest solution.
精彩评论