How to add reference an assembly that is not in the GAC from a t4mvc template (.tt)

Posted by stephen on Stack Overflow See other posts from Stack Overflow or by stephen
Published on 2010-05-12T13:48:56Z Indexed on 2010/05/12 13:54 UTC
Read the original article Hit count: 246

Filed under:
|
|

I have found the place near the very top in a T4MVC template file (.tt) where assembly references can be added, which looks like:

<#@ assembly name="System.Core" #>  
<#@ import namespace="System.Collections.Generic" #>

However, it seems that I can only reference assemblies that are in the GAC. i.e. if I have an assembly MyProject.Stuff.dll (not in the GAC) added as a reference to the VS project containing the template then I expected to be able to add something like the following:

<#@ assembly name="MyProject.Stuff" #>
<#@ import namespace="MyProject.Stuff" #>

If I do this then I get the following error:

Error 1 Compiling transformation: Metadata file 'MyProject.Stuff' could not be found C:\Work\Development\DotNetSolution\MyProject\Utils\T4MVC\T4MVC.tt 1 1

How can I add a reference to an assembly that isn't in the GAC?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about T4MVC