Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling Hot Reload for .NET Core project in Visual Studio 2019

Some time ago, a Visual Studio update added a hot reload feature. It be handy, but it also can be annoying especially when you're testing and you don't want to reset the current state of the front end. Visual Studio injects the script whether you're debugging or not.

How can hot reload be disabled? My Visual Studio version is 16.10.3

https://devblogs.microsoft.com/visualstudio/speed-up-your-dotnet-and-cplusplus-development-with-hot-reload-in-visual-studio-2022/

like image 350
Brian Avatar asked Sep 02 '25 01:09

Brian


2 Answers

You can change this feature here:

Tools > Options > Projects and Solutions > ASP.NET Core > Auto build and refresh option

Options to automatically build and refresh the browser if the web server is running when changes are made to the project.

Your options in this dropdown are the following:

  1. None
  2. Auto build on browser request (IIS only)
  3. Refresh browser after build
  4. Auto build and refresh browser after saving changes

Also note my version of VS is 16.11.1.

like image 65
ShawnOrr Avatar answered Sep 07 '25 02:09

ShawnOrr


in VS 2022 open launchSettings.json in the Properties folder

find your profile and add (see arrow, don't add arrow)

{
  "$schema": "https://json.schemastore.org/launchsettings.json",
  "profiles": {
    "Gang.Bingo.Web": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:7249;http://localhost:5249",
      "dotnetRunMessages": true,
      "hotReloadEnabled": false   <===========
    }
  }
}```
like image 30
Anthony Johnston Avatar answered Sep 07 '25 02:09

Anthony Johnston