Ziff Davis EnterpriseDevLife
Advertisement
Advertisement

Monday, May 25, 2009 8:49 AM/EST

Get VS2010 Extensions easily with built-in Extension Manager (and checking out a VS2010T4 editor)

This post ends up being about two things. The first is a great feature of VS2010, the Extension Manager and the other is about Tangible Engineering's (not to be confused with Tangible Software Solutions who make the great code converters, Instant VB, Instant C# and more) new VS2010 Beta 1 compatible T4 editor.

I'll start with T4. T4 stands for Text Template Transformation Toolkit. It is a code generator that Microsoft built and was part of VS2008. T4 looks something like ASP.NET. In a T4 template you will see code that needs to be executed embedded in <# mycode #> as well as text that just gets written out to the generated file. The embedded code will make some decisions and also spit out text to the generated code file.

T4 was "hidden" because VS2008 had no pre-written templates and no editor. Clarius Consulting created a T4 editor called, Visual T4, that is probably the most widely used and well known. Another company which has a .NET code gen platform, Tangible Engineering, also has a T4 editor.

T4 can also be used against a model. Entity Framework's EDM is an xml based model and a perfect candidate for T4. In VS2010, the EF team abandoned their code genration API and is now using T4 templates to generate classes from the model. Plus you can customize the templates to define how you want those classes generated. This is a huge feature of EF4. I wrote a quick intro to this on my other blog, Customizing EDM Code Gen in EF4 .

I have been messing with the T4 by hand but decided I was ready to use an editor and discovered a blog post about Tangible's VS2010 editor being available already.

I went to their website and went around in circles trying to find the download. FInally I realized what I was missing. The information kept saying that the download was in the VS2010 Extension Manager. I finally woke up and realized what that meant.

In VS2010, go to Tools/Extension Manager.

 

Click Online Gallery.

 

Browse in amazement at all of the extensions available. (Detour - visit the Visual Studio Extensibility Developer Center to learn how you can create your own extensions!)

Select the T4Editor and then click Download on the right.



If you click Installed Extensions, you will see that the extension is now installed. But you still have to restart Visual Studio for this to kick in.


Now when you open up a .tt file, instead of looking like this:


it will look like this:

Did you happen to notice that this EF4 template is written in VB? The EF team created C# and VB versions of all of their templates! Good on ya, team! (Yes, I picked up that saying when I was in Newfoundland a few summers ago.)

Visit Tangible Engineering's Editor page for tutorials on how to use their T4 Editor.

I will also be keeping a watch on VisualT4 as I suspect they will have their editor ready for VS2010 Beta 1 very soon now.

TrackBack

TrackBack

http://blogs.devsource.com/cgi-bin/mte/mt-tb.cgi/17129

Post a Comment

 
 

Advertisement

Syndication

Subscribe: