ASP.Net Core Browser Reload on Save

In this post we are going to overview how we can reload the linked browser on save after making changes in our source to make our development faster.

Go to marketplace to download Browser Reload on Save Visual Studio extension:

Install it then follow the steps.

Next we are going link our browser by configuring our ASP.Net Core application. Download the source:

Open the source using Visual Studio 2017 then rebuild the solution to restore packages. After successful build let configure the browser linkup. Go to NuGet to install package: Microsoft.VisualStudio.Web.BrowserLink

After installation the package let’s open the Startup.cs file to configure by adding “app.UseBrowserLink();” in configure method.

Next configuring in tsconfig.json to compile typescript on save change

"compileOnSave": true

Finally add watcher to copy compiled file from development to output folder.

Add package for gulp watch using package.json

"gulp-watch": "5.0.1"

Finally run the task based on file changes

gulp.task('watcher', function () {
    return gulp.watch(['clientapp/**/*.html', './clientapp/**/*.js'], ['build-all']);
});

This will compile the typescript then transferred by task runner while at the same time the browser will get reload. That’s it build and run the system to see the automated result.

Author:

Since March 2011, have 8+ years of professional experience on software development, currently working as Senior Software Engineer at s3 Innovate Pte Ltd.

2 thoughts on “ASP.Net Core Browser Reload on Save”

Leave a Reply