问题
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
回答1:
There's no way to do this. You should either include unmodifiable code blocks in the template itself, or read them from another file.
来源:https://stackoverflow.com/questions/4546715/t4-custom-code-blocks