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.

  1. 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

  2. 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:

  3. 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:

  4. Show line numbers: besides having version numbers on the status bar, you can also have them on the left; go to ToolsOptionsText Editor All Languages and select Line Numbers:
  5. 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;
  6. Add search box to the toolbar: on the standard toolbar, click the button with the triangle pointing down, then select Add or Remove Buttons:

    imageand then choose Find; you will get a search box for your source code:
  7. 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
    Browse WithThen select Browse With:
    Default Selected Browser
    And select several at once:
    Multiple Default Browser
  8. Change CodeLens options: right clicking on CodeLens will bring the options dialog:
    imagefrom which you can change what to display:
  9. Change variable value from the debugger: if you have a variable, settable property, field or parameter in the watch window, you can change its value by clicking on the right column and entering an appropriate expression:
  10. 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!


No Comments

Add a Comment

As it will appear on the website

Not displayed

Your website