如何显示.Net T4生成的代码(不是输出)?

Gon*_*ing 12 .net t4 visual-studio-2010

我们有一组T4模板,我们刚刚迁移到VS 2010并且它们已经编译但不再一样.

为了能看到什么是真正回事引擎盖下它会看到T4产生,产生的实际T4转换临时CS文件非常有用.

Gar*_*thJ 7

当您现在使用Visual Studio 2010时,您还可以临时将模板上的自定义工具从TextTemplatingFileGenerator更改为TextTemplatingFilePreprocessor.

这将直接将底层代码吐出到您的项目而不是常规模板输出.


Joh*_*ers 5

如果你设置

<#@ template  debug="true"#>
Run Code Online (Sandbox Code Playgroud)

然后生成的代码将保留在临时目录中.在我的Windows 7系统上,就是这样C:\Users\John Saunders\AppData\Local\Temp.