Reputation: 7146
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
Upvotes: 33
Views: 27055
Reputation: 421
I use Microsoft Visual Studio Community 2022 (64-bit) -
Version 17.9.6. Navigation to the option is different in my case: Tools->Options->Debugging->General, then uncheck Enable Hot Reload.
Upvotes: 3
Reputation: 41
I had the same problem, go to Tools > Options > Debugging > General
and check this option Enable edit and continue and hot reload
Upvotes: 4
Reputation: 9604
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 <===========
}
}
}```
Upvotes: 10
Reputation: 61512
In VS2022, unchecking the "Enable Hot Reload" setting under the projects Debug Properties disables the injection of the aspnetcore-browser-refresh.js
script.
These screenshots show one way to access the setting:
Upvotes: 11
Reputation: 7146
This isn't a great solution, but it's a viable workaround.
In the "Network" tab of Chromium Edge's developer tools, I found the request to load aspnetcore-browser-refresh.js
. I right click on it and selected "Block URL". This prevents the script from loading.
Upvotes: 8
Reputation: 1329
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:
Also note my version of VS is 16.11.1
.
Upvotes: 30