Share via


Info on "How to call GAX-based T4 Templates (that have a Property Directive) from standard T4 Templates" posted by tangible

GAT/GAX toolkit has been using property directive in Text Templates like this.

<#@ template language="C#" #>

<#@ output extension=".cs" #>

<#@ property processor="PropertyProcessor" name="ClassName" type="System.String" #>

<#@ property processor="PropertyProcessor" name="Namespace" type="System.String" #>

namespace <#= Namespace #>

{

    class <#= ClassName #> {

     // more.

   }

}

While this directive is not supported by the DSLTools Host which is the default Host for Text Templates in Visual Studio there is often the question how to call a Template and pass in property values like done here:

<#@ include file="T4GAXRunner.ttinclude" #>

<#   GetT4GAXRunner().Render("GAXSample.t4",

        new {ClassName="MyClass", Namespace="ns"}); #> <

tangible has now posted a Standard DSL-Tools-Host Text Template nick-named "T4GAXRunner" that can call a GAX template and pass in parameters very nicely. It works directly on a plain VS + GAX Box - so also on boxes that have no Editor or on Build boxes.

Here is the article on How to call GAX-based T4 Templates (that have a Property Directive) from standard T4 Templates by tangible engineering.

Very nice indeed.

Comments