2

I am new to .NET Core 6 project using Razor views. One problem I am having now is that, every time I make a minimal change to a page, I need to recompile so that I can see the change in the browser.

I am using IIS Express as the server. That way, I can develop while the server is still running, but there is a thing left to solve, and it is to avoid to recompile the project when I change a view.

I realized if I make a change to a view, change is not seen until I recompile the project.

Any help?

jstuardo
  • 3,901
  • 14
  • 61
  • 136

1 Answers1

0

I think what you want is Hot Reload:

Supported ASP.NET Core Scenarios

For ASP.NET Core developers who are targeting .NET 6, there are additional capabilities not available for lower versions of .NET. These capabilities include:

  • CSHTML: Editing a Razor CSHTML file supports many types of edits.
  • Browser Refresh: Editing a razor file automatically refreshes the changes in your web browser when debugging. This feature was previously only available when starting the app without the debugger.
  • CSS Hot Reload: You can change CSS files while the app is running, and changes are applied immediately to the running app as you type.
  • No Debugger: You get Hot Reload support when using Visual Studio to start your web app without the debugger (CTRL-F5).

You can enable Hot Reload by going to Tools → Options → Debugging → .NET / C++ Hot Reload:

menu showing how to navigate to hot reload options

Timothy G.
  • 6,335
  • 7
  • 30
  • 46