1

I'm attempting to run TextTransform.exe to generate code using a T4 template file. The template file is dependent on the T4Toolbox (specifically, it contains classes implementing the T4Toolbox.Template class).

As such, it includes the file t4toolbox.tt, which contains the following directives:

<#@ dte processor="T4Toolbox.DteProcessor" #>

<#@ TransformationContext processor="T4Toolbox.TransformationContextProcessor" #>

During execution, I get the following error for both the referenced processors:

C:\Program Files\T4 Toolbox\t4toolbox.tt(1,4) : error : A processor named 'T4Toolbox.DteProcessor' could not be found for the directive named 'dte'. The transfo
rmation will not be run.  The following Exception was thrown:
System.IO.FileNotFoundException: Failed to load directive processor T4Toolbox.DteProcessor.
   at Microsoft.VisualStudio.TextTemplating.CommandLine.CommandLineHost.ResolveDirectiveProcessor(String processorName)
   at Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, List`1 directivesT
oBeProcessed)

I'm running the exe with the following parameters:

TextTransform.exe
-I "C:\Program Files\T4 Toolbox" 
-P "[Framework3.5],[VS2008 PublicAssemblies]" 
-dp "XsdProcessor!T4Toolbox.XsdProcessor!T4Toolbox.dll" 
-r "T4Toolbox.dll" mytemplate.tt

I've tried to include addition directive processors with multiple -dp parameters, and with a comma separated list (I can see both the DteProcessor and TransformationContextProcessor are implemented in T4Toolbox, so presumably the syntax is similar to the specification of the XsdProcessor?)

Any ideas on how to get rid of these errors? The template generation runs perfectly inside visual studio.

Phil Young
  • 363
  • 3
  • 13

1 Answers1

1

I managed to resolve the noted errors with some adjustments to the command line parameters. TextTransform.exe seems to need multiple paths or directives specified individually. I also had the processing assembly incorrect (-r)

For example: TextTransform.exe -I "C:\Program Files\T4 Toolbox" -P "[path1]" -P "[path2]" -dp "T4Toolbox.DteProcessor!T4Toolbox.DteProcessor!T4Toolbox.dll" -dp "T4Toolbox.TransformationContextProcessor!T4Toolbox.TransformationContextProcessor!T4Toolbox.dll"
-r Microsoft.VisualStudio.TextTemplating.VSHost.dll" mytemplate.tt

However, unfortunately, resolving these couple of issues led to a dead end. Use of the T4Toolbox is not currently supported.

http://t4toolbox.codeplex.com/discussions/52069

Instead, I'm looking at calling MSBuild. The following has been a great reference: http://www.olegsych.com/2010/04/understanding-t4-msbuild-integration/#ConfiguringTransformationEnvironment

Phil Young
  • 363
  • 3
  • 13