dotnet watch cannot Hot Reload scoped CSS from a hosted Blazor WebAssembly client project
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When an ASP.NET Core server hosts a referenced Blazor WebAssembly client, saving a `.razor.css` file in the client produces this warning:
```text
[ScopedCssHotReloadRepro.Server (net10.0)] Scoped CSS bundle file 'ScopedCssHotReloadRepro.Client.bundle.scp.css' not found.
```
The scoped-CSS change isn't applied to the running application. A full rebuild/restart generates and serves the updated CSS correctly.
### Steps to reproduce
Minimal reproduction project:
[ScopedCssHotReloadMissingBundle.zip](https://github.com/user-attachments/files/31890788/ScopedCssHotReloadMissingBundle.zip)
1. Use the attached minimal reproduction, which contains:
- `Server`: `Microsoft.NET.Sdk.Web`, targeting `net10.0`.
- `Client`: `Microsoft.NET.Sdk.BlazorWebAssembly`, targeting `net10.0`.
- A project reference from `Server` to `Client`.
- A Razor component and matching `.razor.css` file in `Client`.
2. Run:
```powershell
dotnet watch --project Server/ScopedCssHotReloadRepro.Server.csproj
```
3. Open the application in a browser.
4. Change any css in `Client/Pages/ScopedCssDemo.razor.css` and save.
### Expected behavior
The client scoped-CSS bundle is regenerated and the running browser displays the new css without restarting the application.
### Actual behavior
`dotnet watch` logs the missing-bundle warning shown above, the generated scoped-CSS bundle remains stale, and the browser continues to display the old style until the application is rebuilt and restarted.
### Is this a regression?
Yes this setup was working perfectly find in dotnet 9 versions and earlier, verified on the repro project on sdk version 9.0.308.
### Are there any workarounds?
_No response_
### dotnet --info output
```console
.NET SDK:
Version: 10.0.400
Commit: 14fbf8d527
Workload version: 10.0.400
MSBuild version: 18.9.6+14fbf8d52
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.400\
.NET workloads installed:
[maui-android]
Installation Source: SDK 10.0.400
Manifest Version: 10.0.20/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.20\WorkloadManifest.json
Install Type: Msi
[maui-tizen]
Installation Source: SDK 10.0.400
Manifest Version: 10.0.20/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.20\WorkloadManifest.json
Install Type: Msi
Configured to use workload sets when installing new manifests.
Host:
Version: 10.0.11
Architecture: x64
Commit: e2f47b0110
.NET SDKs installed:
8.0.417 [C:\Program Files\dotnet\sdk]
9.0.308 [C:\Program Files\dotnet\sdk]
10.0.200 [C:\Program Files\dotnet\sdk]
10.0.303 [C:\Program Files\dotnet\sdk]
10.0.400 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
### IDE version
Rider 2026.2.1
### Other details
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Extract the attached ScopedCssHotReloadMissingBundle.zip and start by running dotnet watch --project Server/ScopedCssHotReloadRepro.Server.csproj. Change Client/Pages/ScopedCssDemo.razor.css and inspect the watch output and generated bundle behavior. Done means the client scoped-CSS bundle updates and the running browser displays the change without a restart.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100