Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save superwalnut/6fcde46f042b45106a3b7347d8d66948 to your computer and use it in GitHub Desktop.
Save superwalnut/6fcde46f042b45106a3b7347d8d66948 to your computer and use it in GitHub Desktop.
code block for create-dotnet-core-console-app-with-autofac-dependency-injection-4
#if DEBUG
var builder = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables();
#else
var builder = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{envName}.json", optional: true)
.AddEnvironmentVariables();
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment