Get EnvDTE.DTE inside t4 template when TextTransform.exe is run manually

Viewed 198

The tt template contains following code:

    var visualStudio 
        = (this.Host as IServiceProvider)
        .GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;

Editing tt from Visual Studio triggers code generation. In this case, the visualStudio variable is not null.

However, visualStudio variable is null, when same tt is run manually via calling TextTransform.exe from command line.

Is it possible to obtain EnvDTE.DTE when TextTransform.exe is run manually? If so, how is it possible to do that?

0 Answers
Related