Most of the .NET developers are using Visual Studio IDE for their development. The Visual Studio IDE has a lot of cool hidden features. Most of the developers are not aware of these features. In this article, we are going to explore hidden features available in Visual Studio.
1) Track active document in the solution
While working on the large solution (which has several numbers of projects), tracking of current opening file in the solution is difficult. If we want to track, then we have to scroll the entire solution explorer to find out the working files or search for a specific file inside solution explorer. It is too difficult and also time-consuming process. But Visual Studio has tracking feature which helps us to understand where we are in the solution/projects.
Visual Studio can automatically highlight the active/working files in the solution by clicking on the "Sync with Active Document" option in the top bar of the solution explorer.
Disadvantage of the above approach is every time we have to manually click this option to track files. Then how to do it automatically without manual action? Yes!!!! Visual Studio has that feature also. Cool.
Follow the below steps to enable the auto tracking feature.
Step 1
Go Tools -> Options
Step 2
Select Projects and Solutions -> General on the left pane
Step 3
Select the option "Track Active Item in Solution Explorer"
This will track your current working files automatically in the solution explorer.
2) Copy multiple items to the clipboard
Mostly if we want to copy multiple lines of code from different places and paste them in a single place or when we needed, then mostly we would copy and paste one by one. It is always affecting our productivity. Then, how to copy multiple code block, and paste them as and when needed? This is another hidden feature of Visual Studio. This built-in feature is known as “Clipboard Ring”. Just cut/copy the code blocks which are stored in a memory and you can use them later by pasting.
How it works?
Copy (ctrl + c) / Cut (ctrl + x) the number of code blocks.
Press ctrl+shit+v Option. A small pop-up window is displayed with all copied items. You can choose which one wants to paste.
Use the same key set to paste the copied items. The clipboard store only the last 15 copied items in the memory.
3) Separate and Maintaining the pinned tabs in Visual Studio
Most of the times we have pinned the frequently used files. Even if pinned the files, those files are aligned with other opened files in a single row. So, it is difficult to maintain/track the pinned files with other files. Pinned Tabs are very useful features in Visual Studio where we can maintain the pinned files in a separate row and refer them quickly.
Go to Tools -> Options -> Environment -> Tabs and Windows and checked the "Show pinned tabs in separate row" option.
4) Use "Run To Cursor" and save time while debugging
It is another cool hidden feature which can improve productivity while debugging. If we want to stop the debugger in a particular line then most of us add the breakpoint and run the application. So, the debugger will stop on the targeting line. Is it possible to reduce the work? Yes. We can.
"Run to Cursor" is just like another breakpoint, but in this case, we don’t need to start the Visual Studio debugger manually and the breakpoints are cleared when it’s hit. When you select the "Run to Cursor" option, visual studio starts the debugger automatically and stopped on the selected line.
Right click on the line where you want to stop the debugger, select the "Run to Cursor" option from the context menu. The Visual Studio starts the application and it will stop on the line you had selected. From here we can continue the debugging. Shortcut for this option is "ctrl + F10".
5) Open the application in the multiple Browsers
While working on the web application (mostly front-end), we want to test the application in different browsers. When we run the application, it will open in the default browser. Most of the time we manually copied the URL and opened it in another browser. Do you think, is this improve our productivity? No Definitely Not. Visual Studio has the option to run the application in different browsers with just a single click.
Follow the below steps to open the application in multiple browsers.
Step 1
Click on run dropdown -> Web Browser -> Click "Select Web Browsers... " option.
Step 2
The Browser option window will be displayed. Select the browser which you want to test and click OK.
Step 3
Hit the ctrl+ F5 or select "Start Without Debugging" option under the Debug menu. The application will be opened with all selected browsers.
6) Convert JSON And XML Object Into Class
Visual Studio has a super cool feature which is to generate the classes from a JSON/XML object using just copy-paste. Please refer to my other article about the details of this feature.
In this article, we have learned about various Visual Studio hidden features which help us to improve our productivity.