visual-studio-2010 - 从其他 T4 模板运行 T4 模板

标签 visual-studio-2010 templates t4

有谁知道是否可以在 VS2010 内从另一个 T4 模板运行 T4 模板文件

谢谢

最佳答案

是的,可以。我就是这样做的:

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); 

关于visual-studio-2010 - 从其他 T4 模板运行 T4 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3636094/

相关文章:

c# - 如何导出VS2010命令行构建/编译参数

python - Django URL、模板、模型和 View 的命名约定

c++ - gcc 和 class 关键字

c# - 将字节数组传递给 T4 模板代码到另一个相同类型的数组

entity-framework - 将我的模板添加到 Studio 2010 中的代码生成项列表

c# - 即时窗口是否正在逐步取消?

c# - 如何找到一段代码的执行时间?

c# - Visual Studio 2010 内存消耗

c++ - 基于类模板参数专门化 C++ 成员函数

visual-studio - 无法解析指令处理器 T4Toolbox.VolatileAssemblyProcessor 的类型