Search This Blog

Thursday, March 13, 2008

What happened to the Visual Studio 2005 "property" snippet in VS2008?

There's a good reason behind it, I'm sure, but one of the snippets I used constantly with Visual Studio 2005 was the "prop" property snippet and it's changed in VS2008.

The client I'm working for has upgraded to VS2008 so I've begun coding in it and, by and large, it's acting pretty much the same as Visual Studio 2005 except for odd little quirks like this.

The VS2005 property snippet acted like this -- you typed in "prop", double-tabbed, and VS loaded this snippet:

private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}


It was great -- I was using it like second nature. The VS2008 property snippet returns this instead, though:

public int MyProperty { get; set; }

Considerably more "bare bones" than the one I was used to with VS2005. As I mentioned earlier, I'm sure there's a good reason for it (since I notice VS2008 has expanded the number of property snippets for C#) but I do miss the old VS2005 version.

The answer turned out to be pretty simple: just copy the "prop.snippet" file from a workstation that still has VS2005 on it (it's in the "Snippets" directory under VC#) into the matching directory on the workstation with VS2008, renaming it to something like "propc.snippet."

On my machine it just meant getting that "prop.snippet" file and pasting it as "propc.snippet" into "C:\Program Files\Microsoft Visual Studio 9.0\VC#\Snippets\1033\Visual C#".

I'll figure out why it was changed later. For the time being, this gives back a great function.



No comments: