Useful Visual Studio shortcuts

I love keyboard shortcuts in Visual Studio, and can sometimes spend ages trying to work out new ones because in the end they save me time and increase my productivity! Even though I’m a relatively new software developer, I’m constantly amazed at how many seasoned developers ask me ‘ooh – what did you just do there?!’ and ‘which key did you just press?’ etc.

So, I thought I would share some of my favourite Visual Studio shortcuts with you:

Ctrl+, – allows you to navigate to any file. If you know the filename but you don’t want to trawl through 15 projects to find it, this is a great way to quickly find and open files. This is my favourite shortcut!

Ctrl+Shift+F – brings up the “Find in Files” dialog which allows you to do a search for a text string and shows the results in a new window, rather than navigating and stopping when it gets to the next found instance.

Ctrl+K followed by C – comments out any code that you currently have highlighted.

Ctrl+K followed by U – uncomments out any code that you currently have highlighted.

Ctrl+G – allows you to go to a specific line by number. This is very useful when you get an error message because they usually tell you the number of the line of code that has given the error…

F5 – builds and runs the solution in Debug mode

Shift+F5 – exits from Debug mode and stops running the solution

F6 – builds your entire solution

Shift+F6 – builds only the project that you’re currently in (great if you’re working on a really big solution that takes a while to build).

F10 – steps over a line of code in Debug mode

F11 – steps into a line of code in Debug mode

F12 – goes to the declaration of the object/function/class etc that your cursor is currently on. If you’re using Interfaces, then this might only take you to the Interface declaration of whatever it is you want to check out. However if you use Resharper, you can right click and choose ‘Go to implementation’ which skips over the interface and takes you right to the goods!

So there you go! Let me know if you have any favourite shortcuts you think should be included in this list, and I’ll add them!

Tagged with: , ,