ASP.NET 5(VS 2015)中的设计时T4模板 [英] Design-time T4 templates in ASP.NET 5 (VS 2015)

查看:140
本文介绍了ASP.NET 5(VS 2015)中的设计时T4模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ASP.NET 5(vNext)项目中,我似乎找不到在VS 2015 RTM中制作T4模板的方法.

I can't seem to find a way to make T4 templates in VS 2015 RTM, in an ASP.NET 5 (vNext) project.

我什至为Visual Studio 2015安装了 T4工具箱扩展名,但tt模板未转换.

I even installed the T4 toolbox for Visual Studio 2015 extension, but the tt templates are not transformed.

属性Custom Tool没有出现在tt文件属性中,我也找不到"运行自定义工具"命令.

The property Custom Tool doesn't appear in the tt file properties, neither can't I find the 'Run Custom Tool' command.

更新

我想要T4模板的原因是引入了config.json文件和可插拔的配置系统,这是一个了不起的事情,但是代价是没有设置强类型的设置属性.
我已阅读文章介绍了如何实现这一目标,但仍然没有一代.由于我的配置结构非常复杂,因此我考虑制作一个T4模板,该模板将生成一个AppSettings文件.关于此的任何想法显然也很受欢迎.

The reason I want the T4 templates, is the introduction of the config.json file, and the pluggable configuration system, which is an awesome thing, but with the price of not having the setting properties strongly-typed.
I've read this article that explains how to achive this, but there is still no generation. Since I have a pretty complex configuration structure, I thought about making a T4 template that will generate an AppSettings file. Any ideas on that are obviously welcome too.

推荐答案

ASP.Net 5(vnext)项目是一个全新的动物,从技术上讲,它仍处于beta测试阶段,而不是 使他们改变了主意.根据该主题,他们将支持该主题,但没有给出日期.他们似乎确实取得了进展,早在1月份,当我测试我的 T4扩展时,我在项目中遇到了问题文件(现在为json格式)不支持自定义属性,但自2015年7月20日发行以来,它现在似乎可以正常工作.仍在Visual Studio 2015中运行T4的引擎,因此,如果您喜欢其他项目类型,则可以使用它.您可以创建一个控制台应用程序,并使其存储T4文件,但可以在vnext项目中生成它们.如果您想要更清洁的解决方案,还可以尝试使用我的扩展名 T4 Awesome ,它为您提供了一种组织和通过右键菜单调用您的模板.

The ASP.Net 5 (vnext) project is a completely new animal and technically still in beta, its not scheduled for RC til November 2015. Also it's attempting to be completely cross platform so initially the team favored using razor templates instead of T4 for scaffolding. They had no plans to support T4 (or any single file generators) at all until an out cry from the community made them change their mind. According to that thread they will support it but have given no dates. They do seem to have made progress, back in January when I was testing my T4 extension I had issues with the project file(now in json format) not supporting custom properties but as of the release on 7/20/2015 it seems to work now. The engine for running T4 inside of visual studio 2015 is still there so you can use it if you like from other project types. You can create a console app and have it store the T4 files but generate them in the vnext project. If you want a cleaner solution you can also try out my extension T4 Awesome, it gives you a way to organize and call your templates via right click menus.

这篇关于ASP.NET 5(VS 2015)中的设计时T4模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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