title: site.css not found in .NET 6 Web App with custom environment
body: <p>Using the latest default web app template, e.g. <code>dotnet new blazorserver</code>, if I change my environment from <code>Development</code> to, say, <code>LocalDevelopment</code>, debugging locally I lose all my styling because my site.css file will not be found (we use this custom environment when debugging locally, to differentiate from running on our shared Development web server.)</p>
  <p>I believe this is because, per the docs,</p>
  <blockquote>
  <p>static web assets are enabled by default in the Development environment. To support assets in other environments when running from build output, call <code>UseStaticWebAssets</code> on the host builder in <code>Program.cs</code>.</p>
  </blockquote>
  <p>One way to do this, using the .NET 3.1/5 style hosting model, is as follows, to enable UseStaticWebAssets:</p>
  <pre><code>    public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
          Host.CreateDefaultBuilder(args)
              .ConfigureWebHostDefaults(webBuilder =&gt;
              {
                  webBuilder.UseStaticWebAssets();
                  webBuilder.UseStartup&lt;Startup&gt;();
              });
  </code></pre>
  <p>My question is, how do I accomplish this using the .NET 6 style hosting model?  We want to use the new model for all our new apps.  I've tried the following:</p>
  <pre><code>builder.WebHost.UseStaticWebAssets();
  </code></pre>
  <p>This yields this exception:</p>
  <blockquote>
  <p>The web root changed from &quot;C:\Web\BlazorServerApp\wwwroot&quot; to &quot;C:\Web\BlazorServerApp\&quot;. Changing the host configuration using WebApplicationBuilder.WebHost is not supported. Use WebApplication.CreateBuilder(WebApplicationOptions) instead.</p>
  </blockquote>
  <p>and I've tried this:</p>
  <pre><code>builder.Host.ConfigureWebHost(c =&gt; c.UseStaticWebAssets());
  </code></pre>
  <p>and I've even tried this,</p>
  <pre><code>var builder = WebApplication.CreateBuilder(new WebApplicationOptions
  {
      WebRootPath = &quot;wwwroot&quot;
  });
  </code></pre>
  <p>This last bit of code seems to do the opposite of the intention; the root of the app seems to be set to <code>/</code> rather than the intended <code>wwwroot</code>, because in the browser debug window it seems to be looking for <code>/site.css</code> rather than <code>wwwroot/site.css</code>.</p>
  <p>Is there any way, using the new .NET 6 hosting model / minimal templates, to enable using StaticWebAssets in a custom environment?</p>