I have a Feature Extension to add some commands in Visual Studio and it's deployed as a vsix file. Inside one of my command I would like to run a generator.
I have migrated my existing templates to be Preprocessed ones and the existing generators are now "simple" classes which inherits from Generator.
When I try to run a generator I got this exception :
Message=Transformation context was not properly initialized. Please make sure your template uses the following directive: <#@ include file="T4Toolbox.tt" #>.
at T4Toolbox.TransformationContext.Render(String content, OutputInfo output, CompilerErrorCollection errors)
at Templates.PackageGenerator.RunCore() in PackageGenerator.cs:line 31
and the code :
var generator = new PackageGenerator(package);
I know that there's more than generator and template, there's an engine, a host but I can't figure out how to get them. I'm already in the DTE, Visual Studio etc... context because I already have some code manipulating the Solution (and my code is inside
a Feature Extension). I see in the T4Toolbox.tt file two directives :
<#@ dte processor="T4Toolbox.DteProcessor" #>
<#@ TransformationContext processor="T4Toolbox.TransformationContextProcessor" #>
Somehow before calling my generator I should have done what this two directives does ?