views:

211

answers:

2

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

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

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

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

Update #1

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

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.

Update #2

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....

+4  A: 

Try just creating a text file and giving it a .tt extension. VS should recognize it right away. You may just be missing the template.

Spencer Ruport
+1  A: 

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.

Oleg Sych