您可以将自定义T4模板添加到VS2008“添加新项”对话框吗?

时间:2022-03-05 20:39:41

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.

感谢您的建议Preet。这回答了这个问题,但我想我错了。再考虑一下,我现在希望能够自动处理T4模板并从用户输入传递参数。

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.

我现在从一个新的角度看待这个问题。特别是尝试使用Microsoft.VisualStudio.TextTemplating.Engine类和GAX自己从模板生成代码文件。

1 个解决方案

#1


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

看不出原因 - 你只需要创建一个Item模板。有关详细信息,请参见此处和此处

#1


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

看不出原因 - 你只需要创建一个Item模板。有关详细信息,请参见此处和此处