dotnet / dotnet/sdk

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

Open
#53,891 0 comments 0 reactions 0 assignees View on GitHub
Area-Watch
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.