I created a project like this:
dotnet new blazorwasm -f net6.0
I am running the project with:
dotnet watch run
Whenever I save something which should trigger a rebuild, the change is recognised but nothing happens. I just get the following information and nothing more:
watch : File changed: /Path/to/File.example.
It was working fine for a while before stopping unexpectedly.
Full output:
watch : Project supports hot reload and was configured to run with the default run-command. Watching with hot-reload
watch : Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload. Press "Ctrl + R" to restart.
watch : Building...
watch : Started '/usr/local/share/dotnet/dotnet' '' with process id 3155
Determining projects to restore...
All projects are up-to-date for restore.
waveshape -> /Users/example/Projects/waveshape/bin/Debug/net6.0/waveshape.dll
waveshape (Blazor output) -> /Users/example/Projects/waveshape/bin/Debug/net6.0/wwwroot
watch : Process id 3155 ran for 3605ms
watch : Running MSBuild target 'GenerateWatchList' on '/Users/example/Projects/waveshape/waveshape.csproj'
watch : Started '/usr/local/share/dotnet/dotnet' '' with process id 3164
watch : Process id 3164 ran for 557ms
watch : Watching 28 file(s) for changes
watch : dotnet-watch is configured to launch a browser on ASP.NET Core application startup.
watch : Configuring the app to use browser-refresh middleware.
watch : Refresh server running at wss://localhost:61209,ws://localhost:61210.
watch : HotReloadProfile: BlazorWebAssembly.
watch : Started 'dotnet' '"/Users/example/.nuget/packages/microsoft.aspnetcore.components.webassembly.devserver/6.0.1/build/../tools/blazor-devserver.dll" --applicationpath "/Users/example/Projects/waveshape/bin/Debug/net6.0/waveshape.dll"' with process id 3173
watch : Running dotnet with the following arguments: run
watch : Started
watch : Waiting for a browser to connect
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:7081
watch : Launching browser.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5236
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
Content root path: /Users/example/Projects/waveshape
watch : File changed: /Users/example/Projects/waveshape/Pages/Index.razor.
2
Answers
Try with
dotnet watch --project .ProjectName.csproj -v
dotnet watch --project . -v
If you see
it should work correctly.
This is a workaround because there are problems with the hot reload. Other people are having problems as well – https://github.com/dotnet/aspnetcore/issues/38036
I had this problem and can reproduce when the http port is "wrong". I don’t know why it’s "wrong", but port 5220 I had exact same problem, but when I changed to 5180 it works.
The port change has to be done in
launchSettings.json
file.Someone created and issue but got no response yet.