Write your own code snippets in Visual Studio

Code snippets are a great feature in Visual Studio that automate the writing of oft-repeated code. By typing a special shortcut followed by two strokes of the tab key, you get a preformatted template for a commonly-used code segment. (Try it with prop if you don’t know what I’m talking about.) While there are many snippets available in Visual Studio by default, it’s also easy to create your own. Here’s how: Define the code to template For the purposes of this demo, I’m going to create a template to return the result of a conditional ternary operation. The first step is to define what the snippet is going to look like:

return ([something Boolean]) ? [if true] : [if false];

Team Foundation Service Error TF30063

I received this perplexing error message when opening a solution in a Visual Studio instance opened via the “Open a new instance of Visual Studio” link in a TF Service project:

Introducing strong.config

I’ve always been surprised by the obvious lack of strong typing in accessing configuration data. Calls to ConfigurationManager are null reference exceptions waiting to happen, as key changes in the config file or typos in the string passed to the call aren’t picked up until they hit you later on with a runtime exception.

Changing TFS Servers for a Visual Studio Project

I recently had to change a project over from TF Service to Codeplex (more on this project in a coming post!) and found that the process required to change the source control server of a project in Visual Studio isn’t necessarily intuitive. Here’s how it’s done: