简体   繁体   English

Windows服务中的T4文本模板

[英]T4 Text Templates in windows service

I hope microsoft puts some more document on how to use T4 Templates and some scenarios . 我希望Microsoft在如何使用T4模板和一些方案上放一些文档。 Is it possible to use T4 Text templates on a machine which doesnt have visual studio installed but only .NET 4.5 framework ? 是否可以在未安装Visual Studio但仅安装.NET 4.5框架的计算机上使用T4文本模板? I have a windows service into which I want to use Preprocessed Templates. 我有一个Windows服务,要在其中使用预处理模板。 If yes , will it compile .tt files in to service exe or do we deploy .tt files seperately ? 如果是,它将把.tt文件编译到服务exe中,还是我们单独部署.tt文件? Also can be be used in a web application ? 还可以在Web应用程序中使用吗?

A "RuntimeTextTemplate" uses TextTemplatingFilePreprocessor to generate C# from a T4 file that can be executed anywhere to generate the text artifact (this is different from TextTemplatingFileGenerator which generate the text artifact when saving the T4 file in VS). “ RuntimeTextTemplate”使用TextTemplatingFilePreprocessor从T4文件生成C#,该文件可以在任何地方执行以生成文本工件(这与TextTemplatingFileGenerator不同,后者在VS中将T4文件保存时生成文本工件)。

AFAIK TextTemplate.exe can't be redistributed (GarethJ knows) so generating text artifacts from T4 using that tool on a non-VS machine is prohibited. 无法重新分发AFAIK TextTemplate.exe(GarethJ知道),因此禁止在非VS计算机上使用该工具从T4生成文本工件。

Mono has their own T4 Engine which potentially could be used instead. Mono有自己的T4引擎,可以替代使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM