.NET Core: Browser Link

When you make changes to your CSS or JS and you want your .NET Core application to refresh the browser automatically.

I found (As of writing this post) that when I use .NET Core 3.1 It doesn't do the refresh on changes to the JS or CSS. So after a bit of digging I noticed that the browser link functions in Visual Studio didn't see my application. It is being caused by Browser Link not being added to the project by default.

How do we add BrowserLink support to our .NET core application.

First up Nuget Package:

PM > Install-Package Microsoft.VisualStudio.Web.BrowserLink

Next we update our startup.cs file and in our Configure section we add "app.UseBrowserLink"

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
	if (env.IsDevelopment())
	{
		app.UseBrowserLink();
	}
	/// YOUR CODE!

For me I've added it in my env.IsDevelopment so it will only be available when I'm debugging.

That's it, now when I run the project and make a change to my JS or CSS it reloads the browser.