简体   繁体   中英

Can you add custom T4 Templates to the VS2008 “Add New Item” dialog?

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.

Can't see why not - you just create an Item template. See here and here for more details

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM