title: T4 - TT - Using custom classes in TT files
body: <p>I would like to use my own class define in a CS file in my TT.</p>
  
  <p>Example:</p>
  
  <pre><code>public class ClassDefinition
  {
      public string NameSpace { get; set; }
      public string Name { get; set; }
      public string Protection { get; set; }
  
      List&lt;ClassProperty&gt; Properties { get; set; }
  }
  </code></pre>
  
  <p>My TT looks like:</p>
  
  <pre><code>&lt;#@ template debug="true" hostspecific="true" language="C#" #&gt;
  &lt;#@ output extension=".cs" #&gt;
  
  &lt;#@ assembly name="System" #&gt;
  &lt;#@ assembly name="System.Core" #&gt;
  &lt;#@ assembly name="System.Xml"#&gt;
  
  &lt;#@ import namespace="System.Xml" #&gt;
  &lt;#@ import namespace="System.Linq" #&gt;
  &lt;#@ import namespace="System.Text" #&gt;
  &lt;#@ import namespace="System.Collections.Generic" #&gt;
  &lt;#@ import namespace="System.IO" #&gt;
  
  &lt;#@ include file="$(ProjectDir)ClassDefinition.cs" #&gt;
  
  &lt;#
  
  // Read the model file
  XmlDocument doc = new System.Xml.XmlDocument();
  doc.Load(this.Host.ResolvePath("GeneratedXmlFile.xml"));
  
  IList&lt;XmlNode&gt; nodeList = new List&lt;XmlNode&gt;();
  foreach (XmlNode node in doc.DocumentElement)
  {
      switch(node.Name)
      {
          case "Model": 
          {
              ClassDefinition classDefinition = new ClassDefinition();
  </code></pre>
  
  <p>But I have this error message:</p>
  
  <blockquote>
    <p>Compiling transformation: The type or namespace name 'ClassDefinition' could not be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>I checked on internet and tried to:
  - use include
  - use assembly
  - use USING
  But nothing works.</p>
  
  <p>Any ideas ?</p>