2013-03-11 3 views
3

Я хочу использовать другой шаблон t4 для ввода ввода вместо этого. WriteLine («Hello, World!»); .Это возможно?T4 шаблон несколько выходов

<#@ 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(); 
     } 
    } 
#> 

ответ