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.
Neha says:
I checked the same blog at https://www.code2night.com/Blog/MyBlog/Stopping-Browser-Reload-On-saving-file-in-Visual-Studio-AspNet. Thanks for sharing your link also. Your blog helped me to understand the solutions.
Shashangka Shekhar says:
Thanks 🙂