T4 Output to String

感情迁移 提交于 2019-12-06 11:00:50

You can use preprocessed T4 templates to return a string instead of generating a file.

If you change the Custom Tools property on the file in Visual Studio to TextTemplatingFilePreprocessor then when you save the T4 template a class will be generated. This class will have a TransformText method which returns the generated text.

MSDN also has information on run-time text generation with preprocessed T4 templates.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!