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

帅比萌擦擦* 提交于 2019-12-10 10:29:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!