This directive processor supports a T4 directive like this: {#@ ScaffoldingAssembly Processor="ScaffoldingAssemblyLoader" #} By using the above directive, a T4 template will be able to load the Microsoft.AspNet.Scaffolding.dll and then can import any namespaces from there to execute code in them.