Productive Visual Studio Tips

Infaz Rumy
5 min readMar 26, 2021

Visual Studio is considered one of the best IDE’s out in the market and comes with a lot of rich features. Visual Studio supports a wide range of project types from Console to Machine Learning. In this article, I will go through some of the features that I love.

Synchronizing and Multiple Instance

Visual Studio allows you to save your setting and retrieve it from another computer once you logged into the Visual Studio. Here you will able to see that I logged in as Infaz Rumy in the top right corner of Visual Studio

A lot of options like themes, font, startup settings will synchronize with your Visual Studio account however if you don’t like to synchronize the settings you can disable it by going to

Tools -> Option -> Environment -> Account

Now you know how to synchronize your settings in multiple devices now let's see how to use multiple settings in a single device. To achieve this we can use The Experimental Instance in VSSDK to do this go to the visual studio developer command prompt by typing ‘Developer Command Prompt for VS 2019’ in the windows search and type the below command in the console

devenv /rootsuffix <name of the instance>

It will open a separate Visual Studio code instance and once it open do not sign up with your account it will synchronize your existing settings. By running the below command in the command prompt you will be able to launch the created instance.

"<Visual studio installation path>\Common7\IDE\devenv.exe" /RootSuffix <Name of the Instance>

Creating your own snippets

snippets are known as a reusable small proportion of code for example in Visual Studio if you in a C# project you can simply create a Property by typing ‘prop’ and pressing the tab twice. There are a lot of snippets available in different languages to find more about it go to

Tools -> Code Snippet Manager

Yes, there are Snippets available but what if you need to create a custom snippet, Guess what you can create your own snippets. The easiest way to do this is by using a Snippet Designer. for this I am going to use ‘Snippet Designer’. You can find the extension from the Visual Studio Extension Manager or by going to the below link

Assume I need to create a Snippet for the Constructor of the Student class which consists two-parameter for that what I need to do is select the Constructor and right-click you will see ‘Export as Snippet’

Once you click ‘Export as Snippet’ you will land on a new page with the extension .snippet. The below image will show how to construct the Snippet

After creating the snippet I saved it under the name of the snippet which is ‘ctor2param’ then once I go back to Class1.cs and type the name of the snippet Visual Studio showed the created snippet.

Bookmarks

You might already use bookmarks in your browser, which are a set of shortcuts to navigate your browser to a specific page in Visual Studio also get the chance to your bookmarks. You will able to see the bookmark icon at the Menu

You can set a bookmark anywhere in your code by moving the cursor to the line where you want to set bookmarks and click on the bookmark icon or by entering ‘ctrl + k + k’ keyboard shortcut. Once you set a bookmark for a specific line of your code you will able to see the bookmark where you set breakpoints. You can navigate between your bookmarks by pressing ‘ctrl + k’ then ’n’ to next and ‘p’ to previous. Once you go to the bookmark window you will able to see all your bookmarks.

The best part of the bookmarks is that you can create a folder and move your bookmarks to the folder and If you want to explain your code to someone you can set a bookmark and easily navigate between bookmarks and rather than putting TODO comments in the middle of your code you can use bookmarks (your colleagues will be very happy 😂). One thing you want to remember about the bookmarks is that they are set to the line number and not to the code.

These are some of the features that I enjoy using Visual Studio every day and I hope you find these tips helpful. That it's for this article thanks for reading!

--

--