Skip to content

MAUI with "dotnet watch" hot reloading does not work for CSS changes #28134

@RyanTT

Description

@RyanTT

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

MAUI Blazor Hybrid projects and WPF with Blazor projects do not apply CSS changes during hot reload. In WPF Blazor, it's possible to manually hit F5 to see the CSS changes, however in MAUI there seems to be no way to see the changes except for restarting the application.

dotnet watch outputs the following when changing a CSS file:

dotnet watch ⌚ File updated: .\wwwroot\css\app.css
dotnet watch ⌚ No C# changes to apply.

When changing a razor file, the following is logged:

// in WPF
dotnet watch ⚠ [ScsModSync (net9.0-windows)] Expected to find a static method 'ClearCache' or 'UpdateApplication' on type 'Microsoft.AspNetCore.Components.WebView.StaticContentHotReloadManager, Microsoft.AspNetCore.Components.WebView.Wpf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' but neither exists.

// im MAUI
dotnet watch ⚠ [ScsModSync (net9.0-windows10.0.19041.0)] Expected to find a static method 'ClearCache' or 'UpdateApplication' on type 'Microsoft.AspNetCore.Components.WebView.StaticContentHotReloadManager, Microsoft.AspNetCore.Components.WebView.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' but neither exists.

Expected Behavior

Changing a CSS file while having hot reload enabled should make all CSS changes visible without further user interaction.

Steps To Reproduce

  1. Create a new MAUI Blazor Hybrid project
  2. Run the project with the dotnet watch command
  3. Change the app.css file
  4. Changes are not applied to the app automatically. In WPF Blazor, you can hit F5 to refresh manually and see them, but in MAUI this does not work either.

Exceptions (if any)

-/-

.NET Version

.NET SDK 9.0.200

Anything else?

-/-

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorBlazor Hybrid / Desktop, BlazorWebViews/needs-attentionIssue has more information and needs another look

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions