Visual Studio 2005 Item Templates

Yesterday I learned how to create custom Item Templates for Visual Studio 2005. An item template is used to add new items to a project like a starter class file. You can export any of your project files as an item template but you must add the Export Template… menu option to the File menu. I created a custom item template for my help topic template file so I can more easily start a new help topic. I encountered many difficulties and technical challenges in getting my item template exactly as I wanted it.

My help topic template needs a style sheet so I had to edit my template to include the style sheet. You can use a few built-in parameters to replace text in your item template. You can also create custom parameters. I added a custom parameter for the author where I can plug in my name and I used the built-in parameter for the year so the copyright year will always be correct. However I did not like the date format so I had to go to a lot of trouble to change that. I had to create a wizard extension to augment the standard New Item wizard with my own code and add a dynamic custom parameter for replacement in the project file.

I will probably add a page to my web site with complete instructions on how to create a custom item template. It is very complicated and technical so it will serve as a good demonstration of my technical skills.

This entry was posted in ASP.NET. Bookmark the permalink.

Leave a Reply

Your email address will not be published.