Visual Studio 2008中缺少T4代码生成? [英] T4 Code Generation missing in Visual Studio 2008?

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

问题描述

所以我决定袖手旁观,尝试使用VS2008中内置的T4代码生成.

So I decided to roll up my sleeves and try out the T4 code generation built into VS2008.

我打算处理这篇文章: http://www.olegsych.com/2008/09/t4-tutorial-creating您的第一个代码生成器/

I was going to work off of this article: http://www.olegsych.com/2008/09/t4-tutorial-creatating-your-first-code-generator/

因此,我到了这一部分:在主菜单中单击Project-> Add New Item,然后在对话框中选择Code Generation-> File template.并发现我的计算机上缺少代码生成"类别. (在VB和C#项目中都尝试过.)

So, I get to this part: "Click Project->Add New Item in the main menu and select Code Generation->File template in the dialog." and discover that the Code Generation category is missing on my machine. (Tried in both a VB and C# project).

是否可能需要单独下载才能在您的计算机上获得T4?

Is there perhaps a seperate download to get T4 on your machine?

因此,我从CodePlex下载了T4工具箱: http://t4toolbox .codeplex.com/Release/ProjectReleases.aspx?ReleaseId = 27563

So, I downloaded the T4 Toolbox from CodePlex: http://t4toolbox.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27563

现在看来事情已经解决了.我的印象是,VS2005需要下载,而VS2008则不需要.哦,好吧,无论如何看起来它都是一个新版本,因此很可能值得下载.

And things seem sorted out now. I was under the impression that the download was required for VS2005 but not for VS2008. Oh well, looks like its a fresh release anyways so is likely worthwhile to download.

现在看来我并没有本文中显示的所有模板类型.我只有文件,模板,生成器,单元测试 本文中未列出发电机",而本文中没有3.奇怪...

It now seems I don't have all the template types shown in the article. I only have File, Template, Generator, Unit Test "Generator" is not listed in the article, and there are 3 in the article that I don't have. Strange....

推荐答案

您碰巧使用Visual Basic吗? T4工具箱仅为VB提供4个项目项模板-文件,模板,生成器和单元测试.您可能在教程屏幕快照中看到的其他模板是用C#实现的,并生成C#代码.使它们在Visual Basic项目中可用似乎不合适.

Do you happen to use Visual Basic? T4 Toolbox only provides 4 project item templates for VB - File, Template, Generator and Unit Test. The other templates you may have seen in the tutorial screenshots are implemented in C# and generate C# code. It seemed inappropriate to make them available in Visual Basic projects.

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

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