I'm attempting to create some scaffolding for CRUD
classes and would like use T4 to assist in building these classes. I'm just getting started and having an issue calling a class that lives in the same project. Ex:
<#@ import namespace="System.Collections.Generic" #>
<#@ template language="C#" #>
<#@ output extension=".cs" #>
<#@ include file="T4Toolbox.tt" #>
using System;
using System.Data;
using System.Data.Linq;
using System.Collections.Generic;
namespace TTFileGenerator
{
<#var entityName = "TEST";#>
public class <#=entityName#>
{
<#
MyClass myClass = new MyClass();
List<string> something = myClass.GetSomething()
...
#>
}
}
The error:
Compiling transformation: The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)
It is a public class in the same project. I can access it from other classes in the project just not the T4 file. Still a T4 newbie. Any direction would be appreciated.
See Question&Answers more detail:os