T4 Toolbox


Extends Text Templates with syntax colorization, tooltips, error reporting, outlining, generation of multiple output files with source control integration, support for template parameters in Solution Explorer properties and more.

(16) Review
Visual Studio
Download (42,100)
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Reviews (16)
Q and A (9)
Sign in to write a review
Sort by:

by Mike McIver | November 06 2015

Corrupted my Tangible T4 install ... wasted an hour with this.

by Ralias | April 26 2014

Excellent tool for writing your own code generator though the quality of the documentation can be improved.

by DS19 | October 01 2013

Great tool!

by David Gardiner | June 20 2013

Invaluable for T4 development

by MSF_LG | June 06 2013

The T4Toolbox complete what Microsoft has done with T4 Templates. I will give the T4Toolbox five stars when support for Preprocessed Templates are added.

We created a library of preprocessed templates that is compiled into a dll that we call at design time from a standard T4 script. We do this because standard T4 Templates have limitations that preprocessed templates do not.

Hopefully, Oleg will add preprocessed template support to his T4Toolkit soon. Then I will bump the rating to five stars.

by aurelien.bonnel | February 07 2013


by codekaizen | January 26 2013

by DamianH | October 15 2012

Not updated for Visual Studio 2012, leaving a lot of us with broken T4 templates and project lead is non-responsive.

Oleg V. Sych December 29 2012
| Edit |

Sorry about the wait. New version is now available.

by ccapra | February 13 2012

The extendable classes that Template and Generator work great! So quick to set up new templates that can generated code from a DB or Model.

by Eugene Neva, MCP | December 10 2011

Very useful! Thanks for your job!

by JSK01 | November 04 2010

by NZArch | September 03 2010

by Jeffrey L. Odell | July 07 2010

T4 as provided is an incomplete code generation solution. The t4 toolbox raises it to a level of production usage that makes using t4 in many situations a pleasure. Oleg delved into all its nooks and crannies to make a complete and continually evolving solution for many t4 code generation problems.

by Nico Ploner | May 19 2010

by Nico.Ploner | May 19 2010

by Oleg V. Sych | April 09 2010

Sign in to start a discussion

  • Cannot install T4 Toolbox after upgrading .NET to 4.6
    1 Posts | Last post May 05, 2015
    • Currently the install fails because the only supported .net version indicated in the .vsix is 4.5
  • Where is the CSharpTemplate class ?
    4 Posts | Last post November 30, 2014
    • Hi Oleg,
      can you post an example of how to use your new version ?
      We uses the CSharpTemplate class for all transformations, but it is not available anymore.
    • Ok i replaced CSharpTemplate with Template,
      now all works fine, except tfs checkouts of multiple generated files.
      But it was also not working in previous version.
      Thanks !
    • Thanks for the feedback! It will be back in the first update in a few days.
    • Would be nice to see an example/sample of this used.  The documentation just says "CSharpTemplate" ... and there is nothing to be found online w/ how to use it.  Thank you!
  • .ttinclude
    1 Posts | Last post December 10, 2013
    • do you plan to support .ttinclude extension?
  • Visual Studio 2013 Support
    7 Posts | Last post October 26, 2013
    • Hi,
        do you plan to release a VS 2013 version ?
    • I hope you will. This is one of my favorite extensions.
    • Hi,
      +1 for VS2013 version.
    • +1 + Support for SQL DB projects :-)
    • +1 for me as well. Its a really useful tool.
    • +1 our company would definitely love to have a VS2013 version
    • +1 I need this... can we have some idea of when so we can plan?
  • I do not see the T4 toolbox template after install
    1 Posts | Last post September 27, 2013
    • I installed the T4 toolbox yet when i go to create a new project in VS2012 I do not see the T4 template option. What gives?
  • Crashes my XAML Designer?
    2 Posts | Last post June 15, 2013
    • Hello,
      I recently created the connect feedback item: https://connect.microsoft.com/VisualStudio/feedback/details/789769/xaml-designer-crashes-error-reading-from-the-pipe as I thought my Visual Studio crashed because of a XAML designer error. But it seems the Visual Studio crash is in some way related to the T4ToolBox extension, as I get the following exception just before VS2012 crashes: 
      System.Runtime.InteropServices.COMException was unhandled
        Message=The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
             at EnvDTE.IExtenderSite.NotifyDelete(Int32 Cookie)
             at T4Toolbox.VisualStudio.BrowseObjectExtender.Finalize()
      Hope this helps you to diagnose the problem.
    • Thanks for reporting this, Philipp. I don't think this is the root cause of the XAML designer crash, though. I'll see what I can do fix this.
  • What new features would you like to see in T4 Toolbox?
    7 Posts | Last post June 04, 2013
    • Here are some of the ideas I'm considering:
      - Test adapter to allow running T4 unit tests in Visual Studio Test Explorer
      - Support for SQL DB projects
      - Language service to provide color syntax highlighting and IntelliSense for editing .tt files in Visual Studio
      - An IWizard to allow using .tt files in Visual Studio project item templates
      - Support MSBuild
      Which ones are more important to you? What else would you like to see in T4 Toolbox?
    • Hi Oleg,
      The test adapter and the support for MSBuild would be very welcome in enterprise projects.
      Color syntax highlighting is already provided by a number of tools so that would be very low on my list.
    • Hi Oleg,
      Thanks for the update!
      I'm having some trouble getting my current templates updated to run in the new release. Would you be able to provide some guidance documentation to help us get back up to speed. I know you listed a lot of good details on your blog, but specifically a complete example of how to get access to the DTE to access the removed properties like "Project" would be great.
      I added an assembly directive for DTE, but I'm not sure if it's the right version or if there is something else I'm missing.
    • I was able to get this working.  Here's an example of accessing the DTE.
      <#@ template language="C#" debug="True" #>
      <#@ output extension="cs" #>
      <#@ assembly name="EnvDTE" #>
      <#@ include file="T4Toolbox.tt" #>
          var dte = (EnvDTE.DTE)TransformationContext.Current.GetService(typeof(EnvDTE.DTE));
          var project = (EnvDTE.Project)((object[])dte.ActiveSolutionProjects)[0];
          var projectPath = project.FullName;
    • Joe,
      I'm sorry this caused trouble. I updated my post at http://www.olegsych.com/2012/12/t4-toolbox-for-visual-studio-2012 to show an example of how to get all of the missing properties. It is slightly different than what you posted here. Hope this helps. Let me know if you run into any other conversion problems.
    • Hi Oleg,
      Thanks! Excellent example. Very helpful.
      All this time I thought you were too busy with other things to update your T4 Toolbox for vs2012. Actually it looks like you've been very busy working on the T4 Toolbox. A complete rewrite! That's great. I like the direction you are taking the project. I personally never used any of the things that had to be removed so I have no issue there. 
      Looking at your roadmap, SQLDB project support would be at the top of my list. As much as I'd love to get support of colorized syntax and IntelliSense directly from the T4 Toolbox, as Jonkers stated above, we do already have that from other tools.
      Thanks again,
    • Can you please add support for Preprocessed Templates?  We just moved to VS2012 and we need that ability so that we can stop using VS2010.
  • No T4 Toolbox templates
    2 Posts | Last post April 20, 2013
    • I have installed the T4 Toolbox on two different machines (VS2012), now, and neither one of them are showing the T4 Toolbox templates in the Add New Item dialog.
      Is there some installation step I'm missing beyond installing from Extension Manager and restarting Visual Studio?
    • No, that should be all that's needed. Have you had any recent Visual Studio crashes or problems with other extensions? 
      Try deleting %LocalAppData%\Microsoft\VisualStudio\11.0\ComponentModelCache and restarting Visual Studio.
  • Can no longer use TransformationContext
    2 Posts | Last post January 18, 2013
    • I had a class that descended from Template and it used TransformationContext to access the Host property.  This worked with VS 2010.  I'm now using the T4 Toolbox beta in VS 2012 and when I have a line like:
      string fullname = TransformationContext.Host.ResolvePath(aFileName);
      I get the error:
      Compiling transformation: An object reference is required for the non-static field, method, or property 'T4Toolbox.TransformationContext.Host.get'
      I was able to get around this by adding a ITextTemplatingEngineHost Host property to my class and setting the property after creating an instance of the class.
      Is this by design or will it be fixed?
      Chris Miller
    • TransformationContext now implements the Singleton pattern consistently with other classes in the .NET framework. In particular, instead of exposing several static properties, it now provides just one - Current. All properties that were static before are now instance properties and can be accessed like so: