Skip to content

Zero size css after Blazor Web App is published #62697

Open
@hultqvist

Description

@hultqvist

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

A Blazor Web App using MapStaticAssets and the Assets[] on linked css files will generate unique urls that do not exist once the project is published.
The css files are in the project output wwwroot but without the hashes found in the links.

Image Image Image

Expected Behavior

When I run the project from Visual Studio or the command line, dotnet run, it works as expected with the content of the css files being served from the hashed filenames.

Steps To Reproduce

  1. Create a new Blazor Web App project in Visual Studio
Image
  1. dotnet publish -o _publish/
  2. dotnet _publish/BlazorApp1.dll
  3. Open the website at http://localhost:5000
  4. Notice the styling is missing
  5. View source, open the css file, return zero length file, HTTP 200

Exceptions (if any)

No response

.NET Version

9.0.302

Anything else?

Microsoft Visual Studio Community 2022
Version 17.14.8
VisualStudio.17.Release/17.14.8+36301.6
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

ASP.NET and Web Tools 17.14.114.53116
ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.14.114.53116
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 17.14.114.53116
Azure Functions and Web Jobs Tools

C# Tools 4.14.0-3.25326.11+bd4f2062291278e0df1e3fd3180c0c862495a3a7
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

GitHub Copilot 17.14.827.52834
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager 6.14.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core) 17.14.3.2530601+3372435431977e91904a23ceb1eab689badc1bd9
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools 17.14.26.0
Microsoft SQL Server Data Tools

TypeScript Tools 17.0.40502.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.14.0-3.25326.11+bd4f2062291278e0df1e3fd3180c0c862495a3a7
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.14.0-beta.25230.7+c1a9d78ad4a474a716ccffb4367ed5151e3f7c9f
Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.

Web Compiler 1.14.15
Compiler for LESS, Sass and CoffeeScript files

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issuearea-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions