title: How to create multiple output files from a single T4 template using Tangible Editor?
body: <p>I tried to follow this tutorial: <a href="http://t4-editor.tangible-engineering.com/blog/how-to-generate-multiple-output-files-from-a-single-t4-template.html" rel="noreferrer">http://t4-editor.tangible-engineering.com/blog/how-to-generate-multiple-output-files-from-a-single-t4-template.html</a></p>
  
  <p>with visual studio 2015 (.Net 4.5)</p>
  
  <p>Sample project with error: <a href="http://www.filedropper.com/t4fail" rel="noreferrer">http://www.filedropper.com/t4fail</a></p>
  
  <hr>
  
  <p>I created the Template1.tt with the following source:</p>
  
  <pre><code>&lt;#@ include file="TemplateFileManagerV2.1.ttinclude" #&gt;
  &lt;#@ Assembly Name="System.Core" #&gt;
  &lt;#@ Assembly Name="System.Windows.Forms" #&gt;
  &lt;#@ import namespace="System" #&gt;
  &lt;#@ import namespace="System.IO" #&gt;
  &lt;#@ import namespace="System.Diagnostics" #&gt;
  &lt;#@ import namespace="System.Linq" #&gt;
  &lt;#@ import namespace="System.Collections" #&gt;
  &lt;#@ import namespace="System.Collections.Generic" #&gt; 
  &lt;#
      var manager = TemplateFileManager.Create(this);
  #&gt;
  </code></pre>
  
  <p>I added <code>TemplateFileManagerV2.1.ttinclude</code> from template gallery to my project.</p>
  
  <p>Then I got an error: </p>
  
  <blockquote>
    <p>'Microsoft.VisualStudio.TextTemplating.IDebugTextTemplatingEngine' is
    defined in an assembly that is not referenced. You must add a
    reference to assembly
    'Microsoft.VisualStudio.TextTemplating.Interfaces.11.0,
    Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.</p>
  </blockquote>
  
  <p>So I added references to</p>
  
  <blockquote>
    <p>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.11.0\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.11.0.dll</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.Interfaces.11.0\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.Interfaces.11.0.dll</p>
  </blockquote>
  
  <p>to my project, but nothing changed.</p>
  
  <hr>
  
  <p>The error was in the following method inside <code>.ttinclude</code></p>
  
  <pre><code>public string GetTemplateContent(string templateName, TextTemplatingSession session)
      {
          string fullName = this.Host.ResolvePath(templateName);
          string templateContent = File.ReadAllText(fullName);
  
          var sessionHost = this.Host as ITextTemplatingSessionHost;
          sessionHost.Session = session;
  
          Engine engine = new Engine();
          return engine.ProcessTemplate(templateContent, this.Host);
      }
  </code></pre>
  
  <p>I replaced it with</p>
  
  <pre><code>public string GetTemplateContent(string templateName, TextTemplatingSession session)
      {
          string fullName = this.Host.ResolvePath(templateName);
          string templateContent = File.ReadAllText(fullName);
  
          var sessionHost = this.Host as ITextTemplatingSessionHost;
          sessionHost.Session = session;
  
          //Engine engine = new Engine();
          return "";//engine.ProcessTemplate(templateContent, this.Host);
      }
  </code></pre>
  
  <p>to check if the problem is indeed in dll and got:</p>
  
  <blockquote>
    <p>'Microsoft.VisualStudio.TextTemplatingA30AC8B57EFC4307E43667FCD72F5E4857F498C5224AE0D43FFC74B3A98D4FA090794EF196648D62B1BC664AFBA5EDE831067D7D1768A759EBBE83426975F7AA.GeneratedTextTransformation'
    does not contain a definition for 'Host' and no extension method
    'Host' accepting a first argument of type
    'Microsoft.VisualStudio.TextTemplatingA30AC8B57EFC4307E43667FCD72F5E4857F498C5224AE0D43FFC74B3A98D4FA090794EF196648D62B1BC664AFBA5EDE831067D7D1768A759EBBE83426975F7AA.GeneratedTextTransformation'
    could be found (are you missing a using directive or an assembly
    reference?)</p>
  </blockquote>
  
  <p>It seems, that it's not.</p>