Skip to content

Expose a way for apps to trigger browser refresh via dotnet watch #53891

@phil-scott-78

Description

@phil-scott-78

Description

While working on an issue related to dotnet watch and non-compilable files, it became clear that the main missing piece is the ability for an app to trigger a browser refresh using the existing dotnet watch browser refresh infrastructure.

Currently, dotnet watch can detect file changes and refresh the browser, but there doesn’t appear to be a supported way for application code to trigger that same refresh signal.


Scenario

I’m building a markdown-driven site (similar to VitePress/Astro) where content files (e.g. .md) are:

  • Not under wwwroot
  • Parsed and rendered at request time
  • Updated frequently during development

File watching can be handled inside the app (e.g. PhysicalFileProvider + IChangeToken), but there’s no built-in way to trigger a browser refresh when those files change.


Current workaround

  • Custom WebSocket endpoint + injected reload script
  • This duplicates functionality already implemented by dotnet watch

Expected behavior

It would be useful to have a supported way for apps to trigger a browser refresh through the existing dotnet watch pipeline.

See #53709 for context on the original request

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Watchdotnet-watchuntriagedRequest triage from a team member

    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