【发布时间】:2010-04-11 02:14:18
【问题描述】:
我正在使用 T4toolbox,我对生成器的用途感到困惑。我可以运行以下
public class Generator1 : Generator
{
protected override void RunCore()
{
Template1 t = new Template1();
t.Output.File = "t3.txt";
t.Render();
}
}
或者我可以像下面这样直接运行 t4 脚本。
Template1 t = new Template1();
t.Output.File = "t3.txt";
t.Render();
但我也可以使用没有生成器的 t4 脚本来做同样的事情。 所以我的意思是可以用两种方法“脚本-->生成器-->模板”和“脚本-->模板”做同样的事情,我错过了什么吗?
【问题讨论】:
-
什么是 t4?你的代码看起来像 C#.. 我很困惑。
-
@Earlz:T4 是一个内置于 Visual Studio 2008+ 中的 .NET 代码生成器。 hanselman.com/blog/…
标签: t4 t4-toolbox