title: EnvDTE types are not recognized in T4 template
body: <p>I am trying to get up to speed with T4 templates. I found the following example (<a href="http://www.olegsych.com/2008/07/t4-template-for-generating-sql-view-from-csharp-enumeration/" rel="nofollow">here</a>):</p>
  
  <pre><code>&lt;#@ template hostspecific="True" #&gt;
  &lt;#@ output extension="txt" #&gt;
  &lt;#@ include file="T4Toolbox.tt" #&gt;
  &lt;#@ import namespace="EnvDTE" #&gt;
  &lt;#
    CodeEnum enumeration = GetEnum("ContactType.cs");
    WriteLine("Found enumeration " + enumeration.Name);
    foreach (CodeElement element in enumeration.Children)
    {
      CodeVariable value = element as CodeVariable;
      if (value != null)
        WriteLine("… found value " + value.Name);
    }
  #&gt;
  &lt;#+
    private CodeEnum GetEnum(string enumFile)
    {
      ProjectItem projectItem = TransformationContext.FindProjectItem(enumFile);
      FileCodeModel codeModel = projectItem.FileCodeModel;
      return FindEnum(codeModel.CodeElements);
    }
  
    private CodeEnum FindEnum(CodeElements elements)
    {
      foreach (CodeElement element in elements)
      {
        CodeEnum enumeration = element as CodeEnum;
        if (enumeration != null)
          return enumeration;
        enumeration = FindEnum(element.Children);
        if (enumeration != null)
          return enumeration;
      }
      return null;
    }
  #&gt;
  </code></pre>
  
  <p>Somehow none of the types that are in the EnvDTE namespace are recognized. I am using the Visual T4 extension. All EnvDTE types are underlined in red. The template doesn't run, and I'm getting a list of errors like:</p>
  
  <pre><code>The type or namespace ... could not be found (are you missing a using directive or assembly reference?)
  </code></pre>
  
  <p>Does anyone know how to solve this?</p>