-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
Pillar: Technical Debtarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-static-web-assetshelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issue
Milestone
Description
Consider this very minimal Program.cs
:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents();
var app = builder.Build();
app.MapRazorComponents<Layout>();
app.MapGet("/", () => new RazorComponentResult<MyComponent>());
app.Run();
For this app I don't need anything in wwwroot
so I deleted the directory completely. But then the app fails to start, saying:
Unhandled exception. System.IO.DirectoryNotFoundException: C:\dir\MyApp\wwroot\
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__1_0(String contentRoot)
Adding an empty wwwroot
directory makes it work. But requiring an empty directory is pretty weird!
Of course, I know that nearly all apps will actually want some static content in the real world. I'm only filing this because having unexpected dependencies between ASP.NET Core features makes the framework feel less satisfying to use, because you're forced to follow a predefined path and can't slim down your app to only what feels truly necessary.
Metadata
Metadata
Assignees
Labels
Pillar: Technical Debtarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-static-web-assetshelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issue