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
Description
While working on an issue related to
dotnet watchand non-compilable files, it became clear that the main missing piece is the ability for an app to trigger a browser refresh using the existingdotnet watchbrowser refresh infrastructure.Currently,
dotnet watchcan 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:wwwrootFile 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
dotnet watchExpected behavior
It would be useful to have a supported way for apps to trigger a browser refresh through the existing
dotnet watchpipeline.See #53709 for context on the original request