Vitaliy
Vitaliy

Reputation: 100

How to prevent Visual Studio 2019 [16.10.3] from auto page refresh in browser when changing any .js file?

After upgrading to Visual Studio Community 2019 [16.10.3] from [16.9.x] Chrome gets updated every time I save any javascript file. In my workflow it is annoying and does not bring my work any benefits. How to disable this feature? I spent couple hours on searching the internet for the answer, but failed. It may be related to Hot Reload feature, but I still did not find an answer

Upvotes: 1

Views: 1730

Answers (1)

Mark
Mark

Reputation: 595

I also want to disable this and what I found is that a javascript file named aspnetcore-browser-refresh.js is injected into the rendered page. The code in that file sets up a web socket to your web server which then allows the web server to issue a remote refresh of the browser. The browser refresh is triggered by something called dotnet watch, which is a process watching all the files in your project to see if any have changed.

You can read about it here: https://learn.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-5.0#run-net-core-cli-commands-using-dotnet-watch

Apparently this is a new feature in VS2019 for ASP .NET Core apps and is enabled by default.

HOW TO DISABLE

  1. Go to Tools > ⚙ Options > Projects and Solutions > ASP .NET Core
  2. Select Auto build and refresh browser after saving changes in Auto build and refresh option

Upvotes: 1

Related Questions