Visual Studio 2013中的自定义脚手架模板

Sea*_*ean 8 t4 scaffolding visual-studio-2013

以前,使用Visual Studio 2012,我能够将CodeTemplates文件夹放到我的项目目录中,然后修改现有T4 templates或添加全新的T4模板以满足我的特定代码生成要求.

似乎前面描述的方法将不再适用于Visual Studio 2013引入的新脚手架引擎.特别是,新的脚手架逻辑似乎存在于此:

C:\ Program Files(x86)\ Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding

我假设您需要构建一个新的自定义脚手架DLL并使用Visual Studio注册它以执行您自己的代码生成.当然,我不知道该怎么做.

那么,有没有人知道在Visual Studio 2013中使用自定义T4模板生成代码(例如视图)的方法?

小智 11

它固定在RC中.您现在可以使用CodeTemplates文件夹.只需在app root中创建CodeTemplates文件夹并将模板粘贴到那里.更多信息,
在Visual Studio 2013中自定义ASP.NET MVC 5/Web API 2脚手架模板

  • 如何在Visual Studio 2013的"添加"对话框中显示CodeTemplates?我已阅读以下内容:[http://www.hanselman.com/blog/ModifyingTheDefaultCodeGenerationscaffoldingTemplatesInASPNETMVC.aspx] [1] [1]:http://www.hanselman.com/blog/ModifyingTheDefaultCodeGenerationscaffoldingTemplatesInASPNETMVC.aspx转到添加新他们没有显示的项目对话框. (2认同)