Reputation: 10390
Why do I have all this junk in my console, only when using VS 2022?
I set Options -> Projects and Solutions -> ASP.NET Core -> Auto build and refresh options -> NONE
And also disabled 'browser link' here:
None of that stuff appears when running the same project in VS 2019, and I'm pretty sure its messing with my SignalR connections
Upvotes: 8
Views: 4481
Reputation: 800
Per https://developercommunity.visualstudio.com/t/Browser-Link-cannot-be-disabled/1582653#T-N1608441, adding "hotReloadEnabled": false
to your launchSettings.json
profile(s) should suppress the injection of these scripts by Visual Studio. This does not actually turn off C# hot reloading - just turns off the scripts that MSFT injects.
Upvotes: 13
Reputation: 51
For anyone using dotnet cli tool and want to disable the hot reload and console output whatever, and have no luck with dotnet watch --no-hot-reload
, try put this at the very start of your js script:
function removeDotnetHotReload() {
const scriptInjectedSentinel = '_dotnet_watch_ws_injected'
// @ts-ignore
window[scriptInjectedSentinel] = true
}
removeDotnetHotReload()
Upvotes: 4
Reputation: 15237
For aspnet-core-browser-refresh, can you please file an issue at https://github.com/dotnet/sdk, as that's where that code lives?
For Browser Link, I can tell you that right now there's no way to disable those messages in a .NET 6 app without turning off CSS Hot Reload as well (you can turn verbose messages off in the console so they won't show, but they'll still be emitted). If you are ok turning off CSS Hot Reload, you can do that in Tools->Options->Projects and Solutions->ASP.NET Core. Please file feedback at Developer Community about this as well so we can potentially make this more discoverable.
That said, I'm curious why you think this might be interfering with your SignalR connections. If there is interference there, we definitely want to address that as well, but I'm not sure off the top of my head why that would be.
Upvotes: 1