Reputation: 7442
Since T4 runs outside of the context of a project, I don't have access to the current assembly or other assemblies. How can I register access to a referenced assembly, then grab a type from it?
Upvotes: 4
Views: 951
Reputation: 11577
I am guessing you want to access an assembly your building in your project. What I've done in the sample code below is adding a project to my solution called TestLib which I build to the folder .\T4Libs in the solution directory. TestLib has a class called MyHelper which holds a magic number.
FYI VS2010 SP1 added the great feature in that it no longer locks the imported assemblies so that's a good version to use.
<#@ assembly name = "$(SolutionDir)\T4Libs\TestLib.dll" #>
<#@ import namespace = "TestLib" #>
<#
var myHelper = new MyHelper ();
#>
// <#=myHelper.MagicNumber#>
Upvotes: 3
Reputation: 9244
Are you looking for the Assembly directive and/or are you looking for something in the System.Reflection.Assembly class (like LoadFile)?
Upvotes: 0