You can find a few articles out there offering tips and tricks for programs like Visual Studio (VS), SQL Server Management Studio (SSMS), and the developer environment in general. Here’s ours! We don’t pretend to list every trick in the book, but we’ll give you our own. Bear in mind these are small tips, not big, process-changing ones.
We won’t be covering screenshots, practical software, or VS Code, as these subjects are very broad. We may devote future articles to them.
VS and SSMS Tips
We’ll start slowly with CTRL+K, CTRL+D, which is very useful for formatting a file automatically. When I make changes, it is often my first commit if there are formatting adjustments to be made, so that the code changes are more explicit in the commits.
You can also use CTRL+R, CTRL+G to adjust and sort the usings automatically.
The VS formatting configurations are very powerful, but I usually stick with the defaults as they work fine for me.
There is at least one VS extension on the Visual Studio Marketplace: Format All Files. However, this takes longer for a project with numerous files.
We also like to use regions when it helps visibility.
Caution, though: when the class gets big enough to add regions, it could be a sign that it’s too big and can be split. You can also adjust the color of the keyword by changing the Preprocessor Keywords and Text elements.
My favorite feature of both VS and SSMS is the “Show pinned tabs in a separate row” option. This little feature lets you place a few open files in quick access, which comes in handy when browsing many documents at the same time. In my opinion, this is the tips-and-tricks MVP (Most Valuable Player)!
Its not-too-distant little cousin on the Windows taskbar lets you pin files. Personally, I often put VS .sln files, useful SSMS requests, and files I use regularly with other applications here.
Speaking of SSMS, enabling line numbers makes it easy to communicate when sharing screens with colleagues. Who knows why SSMS does not activate this feature by default?
In both editors (VS and SSMS), I really miss the CTRL+W shortcut that closes the current window, which you can find in other programs like Chrome. But don’t worry, you can configure it!
In Tools – Options – Environment – Keyboard, you just assign CTRL+W to “File.Close.” We have to disable the other commands (like Select Current Word… does anyone use this shortcut?) and enter the new shortcut in Global.
You can also click on your mouse’s middle (wheel) button to close windows, as with other programs (browsers, VS Code, etc.).
Another trick I really love are the little Back and Forward arrows that look like web browser buttons. At first, I didn’t like them at all, but as I got used to more elaborate class and method systems, they quickly gained a place in my heart.
On a personal note, a few years ago Microsoft launched the file preview feature enabled by default on definition navigations. I never liked it, perhaps because my CTRL+W was never far away. 😉 At any rate, here’s how to disable it: Tools – Options – Environment – Tabs and Windows.
Speaking of which, one recently-introduced VS feature that has received rather mixed reviews is opening .csproj on double-click by default, instead of expand-shrink project. No worries: Tools – Options – Projects and Solutions – General, and you’re all set!
Exporting and Importing Configurations
Finally, while having to maintain a great deal of configuration in our editors’ settings, we sometimes have to change workstations. Exporting and importing these settings is thus very useful for saving time! You can find it in the Tools menu.
I always keep an up-to-date exported file on the cloud to use when needed, or to share.
Tips for VS Debug Mode
Not long ago, Microsoft added a new feature to modify code at runtime: Apply code changes (or Hot reload with VS 2022). We’ve started using this option and, even if it doesn’t support all the changes, we can already see the value and improved speed it can offer.
In debug mode, after setting a breakpoint, you can move the playback cursor by clicking on the small yellow arrow in the margin and dragging it to the desired location. Very practical when combined with Hot reload!
We also use the immediate window or the watch occasionally to change the values and quicky retry a piece of code.
One more for the road! CTRL+SHIFT+F9 lets you quickly delete all breakpoints. It gives a bonus feeling of satisfaction that comes with the end of a good debugging session.
So here’s a handy little list that finally isn’t so little after all! Do you have any tips or tricks that you regularly use? We’d love to hear about them! Share them with us on LinkedIn and Facebook. Who knows, we might add a few to our list soon!