1
我正在使用t4模板并面临以下问题。我需要将另一个现有的t4模板添加到我的模板中。但是我有一个限制:动态生成包含的t4模板文件的名称。 我用include
这个指令,但它不起作用。动态添加另一个t4模板
<#@ include file="\Helpers\<# FileName.tt#>" #>
我得到一个错误:
An unexpected start or end tag was found within a block. Make sure that you did not mis-type a start or end tag, and that you do not have any nested blocks in the template.
财产FileName
值是动态
为什么你会产生T4 ?我想不出任何其他增加步骤有意义的场景。 – Toxantron
@Toxantron,我有几个t4模板文件。取决于具体情况,我应该将其中的一个添加到我的模板中。但是哪一个将被包含在配置文件中。 – Mykhalik
你试过了吗? '##include file = string.Format(@“\ Helpers \ {0} .tt”,FileName)#>' – Toxantron