T4 自定义代码块 [英] T4 custom code blocks

查看:27
本文介绍了T4 自定义代码块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 T4,您是否可以拥有自定义代码块,不应在生成时覆盖?与 PreserveExistingFile 类似,但用于生成文件中的代码块.我不能在我的场景中使用部分类

With T4 can you have custom code blocks, that should not be overwritten at generation? Like PreserveExistingFile but for a block of code in the generated file. I can’t use partial class in my scenario

推荐答案

没有办法做到这一点.您应该在模板本身中包含不可修改的代码块,或者从另一个文件中读取它们.

There's no way to do this. You should either include unmodifiable code blocks in the template itself, or read them from another file.

这篇关于T4 自定义代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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