Skip to content

Instantly share code, notes, and snippets.

@ccellar
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccellar/a53acdbb904677949597 to your computer and use it in GitHub Desktop.
Save ccellar/a53acdbb904677949597 to your computer and use it in GitHub Desktop.
appsettings.cs
var location = Assembly.GetExecutingAssembly().Location;
var directory = Path.GetDirectoryName(location);
var file = Path.Combine(directory, "config.config");
var t = new ExeConfigurationFileMap();
t.ExeConfigFilename = file;
var config = ConfigurationManager.OpenMappedExeConfiguration(t, ConfigurationUserLevel.None);
var value = config.AppSettings.Settings["hello"].Value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment