dotnet / dotnet/aspnetcore

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

Open
#61,182 1 comment 0 reactions 0 assignees View on GitHub
area-commandlinetools feature-hot-reload
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] 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](https://github.com/modplug/HotReload)
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.