title: ASP.NET Core 6 how to access IWebHostEnvironment before builder.Build() in Program.cs
body: <p>I want to use <code>Environment.IsDevelopment()</code> before <code>builder.Build()</code> in <code>Program.cs</code>. How should I do that?</p>
  <pre><code> var builder = WebApplication.CreateBuilder(args);
   //Code: reach environment
   var app = builder.Build();
  </code></pre>