我想使用另一个 t4 模板来代替 this.WriteLine("Hello, World!"); 。那可能吗?
<#@ template language="C#" hostspecific="True" debug="True" #>
<#@ output extension="txt" #>
<#@ include file="T4Toolbox.tt" #>
Sample Content
<# for(int i=7;i<9;i++){
SampleTemplate template = new SampleTemplate();
template.Output.File = @"SubFolder\SampleOutput"+i+".txt";
template.Output.Project = @"..\ClassLibrary2\ClassLibrary2.csproj";
template.Render();
}
#>
<#+
public class SampleTemplate : Template
{
public override string TransformText()
{
this.WriteLine("Hello, World!");
return this.GenerationEnvironment.ToString();
}
}
#>