没有Visual Studio 2010的T4代码生成? [英] T4 code generation without Visual Studio 2010?

查看:82
本文介绍了没有Visual Studio 2010的T4代码生成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在不需要Visual Studio 2010的情况下运行T4代码生成?基本上,我必须建立一个内部ORM(不要问。如果我有选择的话,我不会)。我打算以亚音速为基础,但要改变一些东西以及它们的工作方式。但是,我的主要问题是我可以从编写的外部应用程序中运行T4,以便可以使用T4的功能吗?还是我最好自己做(我怀疑)?

Is it possible to run T4 code generation without needing Visual Studio 2010? Basically I have to build an in house ORM (don't ask..if I had a choice I wouldn't). I was planning to use subsonic as a base but change some things and how they work. However my main question is can I run T4 from an external application that I write, so I can use the features of T4? Or am I better off doing it myself (which I doubt)?

推荐答案

TextTransform.exe将为您提供简单方案所需的功能:

TextTransform.exe will do what you want for simple scenarios:

http: //msdn.microsoft.com/zh-cn/library/bb126245.aspx

这里是如何从您自己的模板代码运行T4模板在VS 2010中创建:

Here is how to run a T4 template from your own code for templates created in VS 2010:

http://msdn.microsoft.com/zh-cn/library/ee844259(VS.100).aspx

以下是如何使用自己的代码为VS 2008中创建的模板运行T4模板:

And here is how to run a T4 template from your own code for templates created in VS 2008:

http://www.capprime.com/software_development_weblog/PermaLink,guid,104d9faf-5780-42ca-88e5-c0461 .aspx

在Visual Studio外部运行Subsonic T4模板会出现一些问题:

There will be some issues running Subsonic T4 templates outside Visual Studio:

如何为亚音速自动生成t4代码?

我会坚持使用T4而不是使用自己的模板引擎。

I would stick to T4 rather than roll your own template engine.

这篇关于没有Visual Studio 2010的T4代码生成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆