Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T4 Toolbox - Referencing Class in Current Assembly

I am writing a T4 script which reflects over certain classes and provides code generation based on them. The problem is that my script errors out, saying that the classes in my current project cannot be accessed.

The script itself resides in the same assembly as the classes I am trying to reference. I've tried referencing the namespace, the file and adding a reference to the current assembly (the project itself) - all to no avail.

What am I missing?

like image 595
Nicko-Mctricko Avatar asked Jul 21 '10 10:07

Nicko-Mctricko


1 Answers

I believe this is what Nicko and uosɐſ are looking for. Just change the "MyAssembly.CodeGeneration" to the name of the project with the T4 templates.

<#@ assembly name="$(TargetPath)MyAssembly.dll" #>
<#@ import namespace="MyAssembly.CodeGeneration" #>
like image 140
Brian Avatar answered Oct 14 '22 14:10

Brian