views:

58

answers:

2

Hi there,

does anyone know if it's possible to run T4 template file from another T4 template, inside VS2010

Thank

+1  A: 

Yes, you can. This is how I'm doing it:

string templateText = File.ReadAllText(Host.ResolvePath(templateFileName));
Engine engine = new Engine();
string output = engine.ProcessTemplate(templateText, Host);
//this is optional - record all output to your file of choice:
File.WriteAllText(outputFilePath, output); 
veljkoz
A: 

There are multiple optons with different trade-offs:

http://www.olegsych.com/2008/04/t4-template-design/

Oleg Sych