void LoadEnvironmentConfig() { var executingPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); // Check for build_output int buildLocation = executingPath.IndexOf("Build_Output", StringComparison.OrdinalIgnoreCase); if (buildLocation >= 0) { string fileName = executingPath.Substring(0, buildLocation) + "local.config.user"; if (File.Exists(fileName)) { this._environment = new EnvironmentDescription(fileName); return; } } // Web roles run in there app dir so look relative int location = executingPath.IndexOf("Web\\bin", StringComparison.OrdinalIgnoreCase); if (location == -1) { location = executingPath.IndexOf("WebJob\\bin", StringComparison.OrdinalIgnoreCase); } if (location >= 0) { string fileName = executingPath.Substring(0, location) + "local.config.user"; if (File.Exists(fileName)) { this._environment = new EnvironmentDescription(fileName); return; } } throw new ArgumentException("Unable to locate local*.config.user file. Make sure you have run 'build.cmd local'."); }