10 Best Visual Studio Tips & Tricks You Should Know.

1. Insert Breakpoint in Lambda Expression

Sometimes you want to select just the lambda expression, but selecting the start of the line in the gutter will select the entire line and not the internal lambda expression. Instead, right-click somewhere in the lambda expression and selected Breakpoint -> Insert Breakpoint.

Before Insert Breakpoint

After Insert Breakpoint

2. Make Selected Text Uppercase or Lowercase

There are also many other useful functions in the Edit -> Advanced menu.

Uppercase or Lowercase

3. Multiline Cursor Input

This trick allows you to select multiple lines vertically by placing the cursor on the first line start point, holding Alt, and dragging down. You can select text, or just add a cursor to begin typing.

multiline-typemultiline-type-after

4. Collapse All Code (Ctrl + M, O)

This is useful to examine just the signature without the implementation getting in the way.

Before Collapse After Collapse

5. Auto Attach to IIS Process on F5 Without Opening Browser

I like to keep my current state when I’m debugging a web app. That way I don’t have to start from the same entry point each time and navigate to the page I need. With this method, you can hit F5 and it will automatically attach to the IIS Worker Process (even if it’s not running yet) and you can just continue using the site tab that you have already been using in your browser. Just navigate to your web app project properties and select the Web tab. Choose the “Don’t open a page” radio button. Select Local IIS from the drop down and ensure the name of the site is correctly entered in the “Project Url” textbox.

Auto Attach to IIS

6. Generating a GUID

This is a small feature, but I use it all the time. You can generate a GUID from the Tools -> Create GUID menu.

Create GUID

7. Execute Command With Macros

Also from the tools menu, you can configure a commonly used command-line operation using macros related to the current project. Select the Tools -> External Tools… menu option. Add a new item, and you can configure the command, any command arguments (using macros available using the button next to the textbox), and the initial directory. You can also Prompt for Arguments every time, so you can specify the parameters. You can map the command output to the Visual Studio Output Window as well.

External Tools

8. Start Without Debugging

Sometimes it’s useful to kickoff another project but debug another that is dependent on that project. You can do that by selecting the project in the solution explorer, then selected Debug -> Start Without Debugging. This will run the project, but will leave the debugger free to run another project in the solution.

Start Without Debugging

9. Multiple Startup Projects

Other times, you want to debug all the projects in the solution. You can do this by selecting the solution and right-clicking and selecting Properties. Select Common Properties -> Startup Project. From this screen you have the option to choose a single or multiple startup projects.

Multiple Startup Projects

10. View All Todo: and Hack: Comments in Solution

I often leave myself notes in the code to remind me to come back and do something. If you prefix your comment with Todo: or Hack:, Visual Studio offers a nice way to see all of these type of comments from the Task List. Select View -> Task List.

Task List

Please follow and like us:
RSS
Follow by Email
Facebook
Google+
http://dylanvester.com/2015/10/10-best-visual-studio-tips-tricks-you-should-know/
Twitter
SHARE

You may also like...

  • I like ALT + F12 for Peek Definition

    • TheDarkVoid

      Yes, I love this. Especially because you can peek at code that is in the file you’re looking at. Really useful to edit something at the bottom or top of a file without scrolling

    • Reshaper has Go to Definition on Steroids. Especially it works well with interfaces and inheritance.

      • Dylan Vester

        Using ReSharper with Ctrl + Alt + Click to go to implementation is something I use all the time. It can also automatically navigate to the implementation in compiled assemblies as well, and will decompile and let you view the source code as if it were in one of your own assemblies.