Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

hostbuilder add environment variables

 var builder = new HostBuilder();
        builder
        .ConfigureHostConfiguration(config =>
         {
             config.AddEnvironmentVariables(prefix:"DOTNETCORE_");
         })
         .ConfigureAppConfiguration((context, config) =>
         {
             config.AddJsonFile("appsettings.json", optional: false);
             config.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true);
         })
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #hostbuilder #add #environment #variables
ADD COMMENT
Topic
Name
9+6 =