I have a T4 template called ParentTemplate which include another T4 template called ChildTemplate. The idea is that my ParentTemplate is called and generates a file for each time the ChildTemplate is called. However, my ParentTemplate also creates a file (.cs) which I do not need. The Build Action of the ParentTemplate is set to "None" and the Custom Tool is set to "TextTemplatingFileGenerator". The following code is from the ParentTemplate:
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ import namespace="System.IO" #>
<#
for (int i = 0; i < 3; i++)
{
#>
<#@ include file="ChildTemplate.t4" #>
<#
string filename = Path.Combine(path, String.Format("{0}i.txt", myFile));
File.WriteAllText(filename, this.GenerationEnvironment.ToString());
this.GenerationEnvironment.Remove(0, this.GenerationEnvironment.Length);
}
#>
In the ChildTemplate is only the text "Hello World". So the output I want is 3 .txt files with the content "Hello World" and that's it. So no other files like ParentTemplate.cs.
Any idea how to prevent the generation of ParentTemplate.cs?