5

I'm developing on my localhost a new Blazor server-hosted app. I launch the template that it starts you out on... looks very nice. I change the text in the tag, refresh my browser... and no change. I refresh and refresh only to notice no change. Is something wrong?

Then I rebuild and rerun the app again and the change happened. Why do I have to restart the entire server for a small front-end change? I have to do this on every change I make? Even though the changes are for the front-end? If so, then the development experience for MVC apps is way better. I don't have to restart my server for changing the code for the front end.

I know dotnet watch exists, but it doesn't help. It still restarts the server for every change I make for the front-end. I have to wait like 10 seconds for just changing some CSS? Please tell me if I'm doing something wrong, or if this is by design.

Also, I tried the web-assembly version of Blazor. Same results.

AskYous
  • 4,332
  • 9
  • 46
  • 82
  • Does this answer your question? [Is there any hot reload for blazor server-side?](https://stackoverflow.com/questions/58172922/is-there-any-hot-reload-for-blazor-server-side) – Jason Aug 26 '21 at 16:07

3 Answers3

2

I guess you are running the app with the debugger connected? this prevents the recompilation. You need to:

Press Ctrl-F5 to run the app without the debugger.

This should work on Windows using IIS, but on Mac "it's a bit more complex". According to a MSFT representative, they are planning on enabling this functionality for Mac users, but this info is already over a year old (from April 2020).

Jason
  • 2,382
  • 1
  • 16
  • 29
1

I hope you've already found the answer to this question as it was posted three years ago. In the meantime, there have been many changes.

However, I am posting this answer for someone like me who came across this page looking for a solution for .NET Hot Reload with Visual Studio 2022 .NET 7 Blazor Server App.

Please make sure ✔ Hot Reload on File Save is checked to get your new changes on save without recompiling the project.

enter image description here

Zin Min
  • 3,898
  • 1
  • 20
  • 24
0

This issue still happens, and for me is a major downside. It doesn't make any sense to have to recompile entire project just because I changed some text on a page. If this is a design choice, it's doomed! Can't have a designer dependent on developers to recompile whenever a small change is required on simple html! Even if you change an element style you have to recompile!

Hugo A.
  • 218
  • 2
  • 12