Created
March 15, 2013 15:16
-
-
Save khalidabuhakmeh/5170577 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Had to modify the ScriptCs ScriptExecutor to include System.Configuration | |
// It works as expected to get the appSettings, but not the natural way | |
// most devs will be used to with ConfigurationManager.AppSettings, also | |
// not sure if things like SmtpClient will pickup on it. | |
using System; | |
using System.Configuration; | |
var path = Environment.CurrentDirectory + "\\app.config"; | |
Console.WriteLine(path); | |
var configMap = new ExeConfigurationFileMap {ExeConfigFilename = path}; | |
var configuration = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None); | |
var settings = configuration.AppSettings.Settings; | |
Console.WriteLine("name from configuration is : {0}", settings["name"].Value); | |
Console.ReadKey(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment