Is there a way to find out whether an app.config file exists, without using "File.Exists"? I tried
if ( !ConfigurationManager.ConnectionStrings.ElementInformation.IsPresent )
{...}
but IsPresent is false even if app.config with a connection string exists.
Edit: Did I misinterpret the IsPresent Property?
You can create method in static class
And then use where you want
Most simple way that I can think of is to add some "dummy" application setting flag then check for that flag, e.g.:
The
AppDomain
reports on where it expects the configuration file for the application to reside. You can test if the file actually exists (with no need for dummy AppSettings, and no need to try and work out what the configuration file should be called, or where it is located):