public Settings() { var dllConfigPath = Assembly.GetExecutingAssembly().GetLocalPath() + ".config"; var configuration = ConfigurationManager.OpenMappedExeConfiguration( new ExeConfigurationFileMap { ExeConfigFilename = dllConfigPath }, ConfigurationUserLevel.None); var setting = configuration.AppSettings.Settings["PageSpeedExecutableRelativePath"]; var pageSpeedExecutableRelativePath = setting == null || setting.Value.IsNullOrWhiteSpace() || LocalHelper.PathHasInvalidChars(setting.Value) || Path.IsPathRooted(setting.Value) ? DefaultPageSpeedExecutableRelativePath : setting.Value; PageSpeedExecutablePath = Path.Combine( Path.GetDirectoryName(dllConfigPath).EnsureNotNull(), pageSpeedExecutableRelativePath); }