Visual Studio 2013 中的自定义脚手架模板 [英] Custom Scaffolding Templates in Visual Studio 2013

查看:40
本文介绍了Visual Studio 2013 中的自定义脚手架模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Previously, with Visual Studio 2012, I was able to bring the CodeTemplates folder up to my project directory and then modify the existing T4 templates or add entirely new T4 templates to meet my particular code generation requirements.

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

It seems that the previously described approach will no longer work with the new scaffolding engine introduced with Visual Studio 2013. In particular, it seems that the new scaffolding logic resides here:

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

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

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

and I'm assuming that you need to build a new custom scaffolding DLL and register it with Visual Studio to do your own flavour of code generation. Of course, I have no idea how to do this.

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

So, does anyone know of a way to generate code (e.g. Views) using custom T4 templates in Visual Studio 2013?

推荐答案

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

It's fixed in the RC. You can now use the CodeTemplates folder. Just create the CodeTemplates folder in app root and paste the templates there. More at,
Customizing ASP.NET MVC 5/Web API 2 Scaffolding Templates in Visual Studio 2013

这篇关于Visual Studio 2013 中的自定义脚手架模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆