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.
2. Make Selected Text Uppercase or Lowercase
There are also many other useful functions in the Edit -> Advanced menu.
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.
4. Collapse All Code (Ctrl + M, O)
This is useful to examine just the signature without the implementation getting in the way.
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.
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.
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.
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.
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.
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.
Recent Comments