从其他T4模板运行T4模板

mue*_*uek 8 t4 templates visual-studio-2010

有没有人知道是否有可能从VS2010内的另一个T4模板运行T4模板文件

谢谢

vel*_*koz 6

是的你可以.这就是我这样做的方式:

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); 
Run Code Online (Sandbox Code Playgroud)