Markus
Markus

Reputation: 3627

.Net configuration file

I have console app "A" that references another console app "B". "B" app has its own configuration file. When I launch project "A", the application fails, because app "B" cannot configure its components, since it uses the configuration of app "A". How to get around this problem? I want that project "B" to source its own configuration file.

Upvotes: 1

Views: 244

Answers (3)

jrummell
jrummell

Reputation: 43067

You'll have to put the relevant sections from B's configuration file into A's configuration file.

Upvotes: 2

Mark Seemann
Mark Seemann

Reputation: 233125

You can copy the relevant XML sections from B.exe.config to A.exe.config.

A.exe will always read from A.exe.config, but if the relevant configuration sections from B.exe.config are available in A.exe.config, it should still work.

You can merge configuration settings as needed.

Upvotes: 1

Andrew Hare
Andrew Hare

Reputation: 351456

The executing assembly must have all configuration information in its configuration file. You will have to import all settings from "B" into the configuration file of application "A".

Upvotes: 1

Related Questions