I'm currently using a "New Item" template of mine to create several classes in my project based on the Name entered. What I'd like to be able to do, is to also add some lines to an existing file in the project. Is there any way to do this? Is there any way to run some sort of script from within the .vstemplate file?
EDIT: Sorry, I misunderstood the question.
Original answer:
Well, the default templates are in 2 places:
\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplatesCache\CSharp\1033
\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\1033
You can change the template contents for new classes and new forms in there at your leisure... Not sure where user created templates are saved, but there's no reason you couldn't do the same thing to those (to my knowledge.)
For a vanilla item template in Visual Studio there is no way to achieve this. Item and Project templates just allow you to add new files to a project and allow for customizations of those files. But it's not possible to use them to change existing files.
You may be able to achieve what you're looking for though with a template wizard. This allows for the execution of arbitrary code during the processing of a template. You should be able to modify the existing files to your delight with this.
Tutorial Link: