|
Question : .NET app.config in non-project directory - how to access?
|
|
In a .NET C# project I want to place the app.config file in a different directory from the project directory, and be able to access it (ConfigurationManager methods). How do I handle this case?
For example my app resides in:
c:\work\helloWorld\helloWorld.csproj
I want to put app.config under:
c:\mycomp_name\environment\apps\helloworld\app.config
How do I have my code recognize the app.config in the non-standard location/directory?
|
|
Answer : .NET app.config in non-project directory - how to access?
|
|
its the ConfigurationUserLevel that specifies where the file is ... Check out http://msdn2.microsoft.com/en-us/library/system.configuration.configurationuserlevel.aspx
ConfigurationUserLevel.None specifies that it will be in the same directory as the executable.
This will also only apply to your own settings ... there are other settings (such as the CLR settings in the app.config which will not take effect if you use this method). As such you will have 2 config files.
|
|
|