Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop injecting "_framework/aspnetcore-browser-refresh.js" into the body of every generated web page of an asp.net core app. #55734

Open
vsfeedback opened this issue May 15, 2024 · 2 comments
Assignees
Labels
area-ui-rendering Includes: MVC Views/Pages, Razor Views/Pages Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. feature-hot-reload This issue is related to the Hot Reload feaature
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:Other]
Please stop injecting this

<script src="/_framework/aspnetcore-browser-refresh.js"></script>

into every one of the generated web pages while I am developing an asp.net core application.

And yes, I've disabled all the Hot Reload features I know of.

Thank you, Paul.

And no, I am not providing any more information. This product has cost over 2000.00 in terms of man hours to battle configuration issues that seem to rear their ugly head on every update.


Original Comments

Feedback Bot on 5/9/2024, 03:38 AM:

(private comment, text removed)


Original Solutions

(no solutions)

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 15, 2024
@mkArtakMSFT mkArtakMSFT added feature-hot-reload This issue is related to the Hot Reload feaature area-ui-rendering Includes: MVC Views/Pages, Razor Views/Pages and removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 15, 2024
@dotnet-policy-service dotnet-policy-service bot added the Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. label May 15, 2024
@mkArtakMSFT
Copy link
Member

@MackinnonBuck do you remember what is the condition we use to inject the script? How one can disable it?

@daiplusplus
Copy link

daiplusplus commented May 24, 2024

BTW, see also: #45213


I'm trying to disable this "feature" because I need precise control over the generated HTML, so any unexpected injected HTML is a big no-no.

So there's at least three different places where you need to go...

  • Tools > Options > Projects and Solutions > ASP.NET Core > Auto build and refresh option.
    • Ensure the selected option is not "Refresh browser after build" or "Auto build and refresh browser after build"
  • Tools > Options > Projects and Solutions > ASP.NET Core > CSS Hot Reload
    • Ensure this is set to Disabled
  • Standard Toolbar > Browser Link split-button menu > Enable Browser Link and Enable CSS Hot Reload
    • Ensure both options are unchecked, apparently Browser Link has a dependency on the reload script too.

...though in my case, the "Enable CSS Hot Reload" checkbox is checked and disabled... which means it's stuck on (and so causing the script to be injected into all of my pages), which is worsening my blood pressure problems...

image


Update:

There is official advice to set "hotReloadEnabled": false in launchSettings.json, but historically many people have said it didn't work - I had the same problem too, but I noticed that I copied-and-pasted the wrong kinds of double-quotes...

So this is just to help anyone else who runs into the same problem:

image

@mkArtakMSFT mkArtakMSFT added this to the 9.0-preview6 milestone May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ui-rendering Includes: MVC Views/Pages, Razor Views/Pages Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. feature-hot-reload This issue is related to the Hot Reload feaature
Projects
None yet
Development

No branches or pull requests

4 participants