Skip to content

Hot reload broken for CSS changes in Razor class library in .NET 9 (works in .NET 8) #61182

Open
@modplug

Description

@modplug

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

In .NET 9, updating a .css file inside a referenced Razor class library no longer triggers a page refresh or hot reload in the browser.

This worked correctly in .NET 8, where making changes to a CSS file in a Razor class library (e.g. shared.css) would automatically update the browser.

Expected Behavior

The web page should reload / refresh and the changes should be reflected without having to manually refresh the current webpage

Steps To Reproduce

  1. Clone the repro: Hot reload repro
  2. dotnet watch the HotReload project
  3. Modify wwwroot/shared.css in the HotReload.RazorClassLibrary project
  4. Observe: No hot reload or browser refresh
  5. Switch to the dotnet8 branch
  6. Repeat steps 2–4
  7. Observe: Hot reload and browser refresh work correctly

Exceptions (if any)

No response

.NET Version

dotnet 9.0.202

Anything else?

OS: Macos Sequoia 15.3
IDE: Rider 2024.3.6 - Bug also verified using vscode

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions