问题
I have created a set of templates that I want to share across multiple projects. Is it possible to add the template to the Project “Add New Item” dialog such that when I choose it an instance of the code file is generated from the template and added to the project?
Update
Thanks for suggestions Preet. That answers the question but I think I have asked the wrong one. Thinking about it some more, I now want to be able automate the processing of T4 templates and pass parameters to them from user input.
I'm now looking at this from a new angle. Specifically attempting to use the Microsoft.VisualStudio.TextTemplating.Engine
class and GAX to generate code files from templates myself.
回答1:
Can't see why not - you just create an Item template. See here and here for more details
来源:https://stackoverflow.com/questions/689002/can-you-add-custom-t4-templates-to-the-vs2008-add-new-item-dialog