Home > Articles > Details

[hot reload not working] hot reload only works when saving css or svg files in visual studio 2019


Question: hot reload only works with assets in Visual Studio 2019, when I modify an #SVG or #CSS File hot reload kicks in but when I make any changes to the C-Sharp File hot-reload does not work.

Login to See the Rest of the Answer

Answer:
#Hot-Reload works best when you are using Visual Studio to Debug (to run your application) this way Hot-Reload is within the Scope of the #State of the Application. According to my experience, however, when you use the #Console to run Asp.Net Core 6 or 7 #Application the Hot-Reload sometimes does not work.

Here are a couple of things to try to diagnose the Hot-Reload not working in Development:

  1. First, make sure that you are running in Development Mode by starting the application with the following command
    dotnet watch run --ASPNETCORE_ENVIRONMENT=Development?


    If you are wondering about the command below read this article
  2. If step one does not work, keep your eye on the Console there might a prompt from DotNet 6 SDK to Hot-Reload automatically by pressing the letter "A" on your Keyboard.


  3. If step two does not apply, close the Windows Terminal or whatever Shell you are using to run dotnet run command then reopen it again. This kills the previous session and restarts a  new one.
  4. Lastly, you might want to refresh the browser in order to see the changes you made in Visual Studio 2019

  5. If the above does not work for you, make sure that you update your IDE (Visual Studio) if there are any updates pending.

    Leave us a comment if this helped you, good luck!

If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.


© 2022 - ErnesTech - Privacy