Visual Studio Tips 3
Updated: see the fourth post here.
Next round of Visual Studio tips! 10 more for you! Here you can find the first and the second posts.
-
Change solution version: you can change the Visual Studio solution version by opening the .SLN file and changing its header:
Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 12.0.30110.0
=Visual Studio 2013
Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 14.0.23107.0
=Visual Studio 2015 -
Even if you didn’t declare a variable for the exception in a catch block, you can still see it by adding the special keyword $exception to the watch window:
-
Scroll bar options: the vertical scroll bar can show hints for a number of different things, or even display a map of the lines in its window. You can choose what it should be used for by right clicking on the scroll bar and clicking on either bar mode or map mode and selecting changes, marks, errors, etc:
- Show line numbers: besides having version numbers on the status bar, you can also have them on the left; go to Tools – Options – Text Editor – All Languages and select Line Numbers:
-
Move lines up or down: you can move an entire line up or down; just click on it and press <Alt>-<Up> or <Alt>-<Down>; you can also duplicate it with <Ctrl>-<C> + <Ctrl>-<V>, no need to actually select it all;
-
Add search box to the toolbar: on the standard toolbar, click the button with the triangle pointing down, then select Add or Remove Buttons:
-
Open multiple browsers at once: you can open your page in different browsers at the same time, automatically, upon starting (<F5>) or debugging (<Ctrl>-<F5>); just select the down arrow next to the browser selection
Then select Browse With:
And select several at once: - Change CodeLens options: right clicking on CodeLens will bring the options dialog:
-
Add bookmarks: you can easily add bookmarks to lines of code by clicking <Ctrl>+<K>; to remove a bookmark, click <Ctrl>+<K> on the bookmarked line of code; <Ctrl>+<K> followed by <Ctrl>+<N> will navigate to the next bookmark and <Ctrl>+<K> followed by <Ctrl>+<P> to the previous one; adding the <Shift> key to <P> or <N> will do the same, but inside a solution folder.
And that’s all for now. Stay tuned for more!