Speed! - Visual Studio tips

A few tips to improve your Visual Studio experience.

Avoid app pool recycling

During development you will spend a lot of time waiting. Waiting for Sitecore to boot after an application recycling. Typically as a consequence of a modification of DLL in the bin folder or configuration files. So the recommendation is clear, avoid deploying DLLs or change configuration files!

Many people deploy their whole solution every time a changed file needs to be copied to the Sitecore webroot. If you have modified a JS, CSS or a cshtml file you don't need to deploy the whole solution; just deploy the files that have been modified. By only deploying the file you have changed you avoid recycling the application pool unnecessarily.

Of course, if you have a nicely set up development environment this may not even be an issue, as changes to files are automatically replicated.

Locating files

Finding files in large solutions can be challenging. Don't forget you can simply use Ctrl+, in Visual Studio to look for files.

Use layouts

I keep re-arranging windows in Visual Studio, this is particularly true when using a single screen in my laptop. I always forget I can save a particular window configuration using layouts (in the Window tab).
You can then switch between the different layouts using the shortcut Ctrl+Alt+[layout number]. You can re-order the layouts using the manage window layouts window.
WindowLayoutManager

Use snippets

Type less do more. Of course, Visual Studio comes with a whole range of snippets to save you keystrokes. You can also create your own snippets for those bits of code you have to type time and time again.
I have created a small selection of Sitecore related snippets which you can get from the Sitecore Visual Studio Snippets project in Github.

Adding a datasource

It can save you time when doing some common tasks like getting the home item, or the datasource, rendering parameters, item urls, field values, etc.

Unfortunately the snippets can't add namespace references (using clauses) in your file. You can of course delete the fully qualified name and use Ctrl+. to automatically add the using clause. If the reference already exists at the top of your class, the snippet will use the shortest possible qualified name.