tags:

views:

100

answers:

2

Is there way to set the App.Config file from the network share instead of providing it from the same directory where the .EXE is running. For example, Can I do something like this :

        System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile  = @"\\abc.com\root\myshare\it\development\T\_test2\App.Config";

and at runtime all my configuration parameters are set so that I can do something like this in my .cs file with no null exception.

 string environment =  System.ConfigurationManager["Environment"];

I really appreciate any ideas or suggestions on it.

Thanks

+1  A: 

not sure bout your question but it could be possible to use the Machine.config unfortunately i think that if you use the machine.config appSetting section it will always use those value prior to the appSetting of your App.Config

machine.config can be found at Microsoft.NET\Framework\v1.1.4322\CONFIG

remember that no one but the admin should ever be given the right to write in the machine.config for it contains the config of the machine itself ...

i also got a thread of ppl talking about stuff similar to your question on another forum heres the link hope it helps

Link

Lil'Monkey
btw i would never recomend to anyone to use the machine.config unless they got no choice since u dont really want to mess with the machine configs :) gluck
Lil'Monkey
+1  A: 

You can provide the CLR with configuration information for a new application domain using the AppDomainSetup class. When creating your own application domains, the most important property is ApplicationBase. The other AppDomainSetup properties are used mainly by runtime hosts to configure a particular application domain. Changing the properties of an AppDomainSetup instance does not affect any existing AppDomain. It can affect only the creation of a new AppDomain when the CreateDomain method is called with the AppDomainSetup instance as a parameter.

Microsoft reference

Cédric Boivin
That is great answer, do you have any working sample
Shiva