|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
How to: Reference Assemblies in Text Templates
You can add an assembly directive to text templates and use that directive to specify assemblies that you want to use in those text templates. You can add your own assembly to a text template and use types and members from within it. For more information, see.
To add an assembly to a text template
In Solution Explorer, right-click the text template file that you want to edit, and then click Open.
The file opens in the editor.
Add the following directive to the template:
<#@ assembly name = "C:\Assemblies\Assembly.dll" #>
You can either specify a strong name for assemblies in the global assembly cache, or you can specify a fully qualified path to the assembly's file name.
Here is an example of how to specify a strong name:
To access the assembly, add code that is similar to the following:
In this example, Class1 is a type that is defined in the assembly Assembly.dll.
To debug text templates, you must set the debug parameter of the template directive. For more information, see.
For more information, see.