Getters/Setters For Visual Studio 2008/2010

I've been able to get my hands (through legitimate means) on a copy of Visual Studio 2008 Professional Edition.  I installed it this evening and wanted to take it for a spin.

Initial reaction:  just the same as VS2005.  One of my biggest gripes about the VS environment is its complete, utter lack of getters/setters generation.  Sure, you can right click on each of your private fields and generate them, but that takes a long time, not to mention that it places the property at the top of your code and clutters it up.  This should have been fixed in Visual Studio 2005, but  puh-lease what's the excuse for not putting it in 2008?

I had recently found a add-in to do this in Visual Studio 2005, called VsPropertyGenerator 2005, but it wasn't working in 2008.  My blood was boiling with each link that I clicked to find a similar solution for VS2008, but I did find a work around.   All you have to do is follow the installation instructions for it and edit some files.  Now, open the VSPropertyGenerator2.AddIn file in a text editor and you'll see that you have a plain XML markup there.  Find the Version tag, replace 8.0 with 9.0, and voilà it should now work.

Microsoft, I forgave you for not having this in VS2003.  It was your first crack in the OO world.  But we are on your third release of your .NET IDE, so please make this a default feature!

UPDATE 9 AUG 2009: For those of you wondering how to install this in Windows 7, you must create an Addins directory in %DOCUMENTS%\Visual Studio 2008 and drop the files in there.

UPDATE 23 APR 2010: Similarly, for Visual Studio 2010, you will add it to the %DOCUMENTS%\Visual Studio 2010\Addins directory, making sure that you update the compatible version to 10.0.

Posted on Feb 20
Written by Wayne Hartman