Peterson's Ponderings

Technical findings, ideas, thoughts and news directly from me.
in

Project Templates (Visual Studio 2005)

Happy New Year everyone!  As part of the new year I've decided to begin posting bi-monthly blogs (at the least, some may be more frequenet) on technical topics that are currently captivating my interest.  For my first blog I'm going to start off with a less discussed updated feature of Visual Studio 2005 - project templates.  I know, most people will see that topic and thing 'who ever uses those things?'.  That's the same thought I initially had when I began working on my recent MSDN article (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/CreatStrtKt.asp) but after playing with it I starting thinking of how useful this would be to my development teams.  There were two main uses that came to mind that I think almost any development team would find helpful.

1.  Windows services projects - I've built a lot of windows services projects and there is a bunch of routine steps that always have to be coded at the beginning of the project before even getting to business specific logic such as the start/stop controling of worker threads, setting service name attributes, and adding informational logging code to record start/stop/failure.  Since all of this stuff is the the same a project template would fit these projects perfectly.  The template can contain my main service class and my worker thread classes already defined with public start/stop methods so that they can be manipulated from the service code in response to a service start/shut down command.  The main service class can already have the informational logging and entry point for worker thread creation.  With a little extra effort you could add a project template wizard implementation (an advanced template feature) that allowed the user to specify the service attributes when they were opening a new windows service project and then fill it into the class for them.  Now with this project template anyone on the development team could create a new service that conforms to the same standards as all the service created by the team. 

2.  Windows Form projects - There is some repititive stuff in Windows Forms projects a template could handle for me too.  The main thing is adding all the project references to third party components.  Having a standard sub Main routine could be helpful too as it would allow a standard entry point for all windows programs where additional code could be added (such as splash screen start ups, application update code, large data loading, etc).  Since I'm making templates anyway, adding a class template for a windows form that inherits from a common base class (which could have all your application logging, resource loading, standard window look/feel) would be helpful too.  Then developers could just select the custom form template off the Add New Item menu and go right to work on laying out the form design.

These will be my first two templates created once I'm on a project that uses 2005 exclusively.  I'm sure there are more, but they may be more architecture specific - such as templates for components that must implement an interface, or web site/intranet work where projects must utilize common look and feel elements or state management.  I encourage everyone to take a look at this feature and I bet ideas will start popping into your mind on reptitive project tasks you do now.  It's definitely not one of the snazzy features talked about in all the Visual Studio press, but the templates team did a great job on making it simple to use and greatly improving it over the VS 2003 version. 

Comments

Andrew Karcher's Bits o' Data said:

Don Peterson, a Clarity Consultant has just gotten an MSDN article published on Creating Starter Kits....
# January 10, 2006 11:40 PM

Andrew Karcher's Bits o' Data said:

Don Peterson, a Clarity Consultant has just gotten an MSDN article published on Creating Starter Kits....
# January 10, 2006 11:41 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)