Visual Studio Tips

Using Visual Studio Browser Link to Speed Up Development

Posted by matteskolin on

I just discovered how to use Visual Studio browser link. This feature creates a constant connection between the browser and visual studio, allowing Visual Studio to trigger refreshes in the browser.

I had been under the impression that the only purpose for browser link was to test code in multiple browsers, to check compatibility, but I learned that it can also be used when working with a single browser to speed up the development process.

Specifically, the benefit comes when starting the application without debugging (Control + F5). When you start the application without debugging you are able to edit the code while the application is running. Normally, If you change assembly files, and then refresh using the browser, the application will automatically recompile the changed assemblies.

With browser link, you do NOT even have to refresh the page in the browser. You can trigger the refresh from within Visual Studio by clicking on “Refresh Linked Browsers” from the toolbar.

I am using Visual Studio 2019 Enterprise Preview with a .Net Core 2.2 MVC project. Seem Image below. I think it is essential here to create a shortcut to refresh linked browsers. I created mine to be (Control + `). The below screenshot shows another shortcut I tried that did not work because Ctrl + L is bound to so many different actions in my environment.

Enabling Browser link in a .Net Core app

To enable Browser link in .Net Core, you need to call the method next to the comment below. This will cause some javascript to be output to the page to create the link. Also make sure “Enable Browser” link is clicked in the above screenshot.

 public void Configure(IApplicationBuilder app, IHostingEnvironment env)
 {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();

                //Enable Browser Link
                app.UseBrowserLink();
            }
}



Visual Studio Tips

Three Shortcuts for Azure Devops

Posted by matteskolin on

Updated 03/21/2020 – New shorts for navigating to to boards, backlogs, sprints, and queries (b,l,i,q)

For the full list of Azure Devops Shortcuts, see Microsoft Documentation Here

below are the three most helpful shortcuts I have used so far..

(g,w) – Go to work
This shortcut opens up the work items board. Now that the boards dropdown is open, more keys become available to navigate between Work Items, Boards, Backlogs, Sprints, and Queries.

[ w ] – open work items
[ l ] – open backlog
[ b ] – open board (easiest to remember for me; I remember the key combos as (g, w,b) “go to work on the board”
[ q ] q for queries

(g,w) goes here

(g,c) This Shortcut navigates to the Code Category

(g,b) This shortcut goes to the Build Pipeline Home. this may be useful in conjunction with with the above shortcut. In my workflow, I often like to jump between looking at Code, and configuring my builds. These two shortcuts make it easy to jump quickly between the two.

I Still can’t find a way to easily jump between Pipelines.Builds and Pipelines.Releases, hopefully there will be a shortcut for this soon

(g b) goes here

At anytime it is useful to press [?] to show a list of available shortcuts on the current screen.