Hi there, I have a solution with two projects, each project has an app.config file. Project 1 contains no settings, yet when Project 1 launches the ConfigurationManager class, it gets the config settings from the app.config file in Project 2.
How does it do that?
Thanks
Loading

Suthish NairRank #92 · 22.8K reputationPosted Jun 29, 2011, 7:13 AM EDT
Felipe RamosRank #1,409 · 1.2K reputationPosted Jun 29, 2011, 8:28 AM EDT
paul walker29 reputationPosted Jun 29, 2011, 11:26 PM EDT
Project 1 is the procesing module which contains the 'empty' App.Config file and the call to read parameters from the App.Config file (in Project 2) is of Output Type 'Class Library'.
Project 2, which contains the App.Config file with the actual parameters, is a testing harness used to unit test Project 1. This is awindows application.
Note that:=
The startup project is Project2 (as you would expect, it is the testing harness)
In the Solution properties, Project2 is dependent on Project 1, so the build order must be Project1, then Project 2.
Thanks
Paul
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jun 29, 2011, 11:30 PM EDT
As suthish said storing values in XML file... retrieve those values using code behind logic is the better approach....
Felipe RamosRank #1,409 · 1.2K reputationPosted Jun 30, 2011, 4:13 AM EDT
Below is a fragment from the internal initializer
internal ClientConfigurationSystem() { this._configSystem = new ConfigSystem(); this._configSystem.Init(typeof(ClientConfigurationHost), new object[2]); this._configHost = (ClientConfigurationHost) this._configSystem.Host; this._configRoot = this._configSystem.Root; this._configRoot.ConfigRemoved += new InternalConfigEventHandler(this.OnConfigRemoved); this._isAppConfigHttp = this._configHost.IsAppConfigHttp; string schemeDelimiter = Uri.SchemeDelimiter; }