Sharing common code

CodeSmith Generator gives you several ways to share code between templates:

Approach How
Base template class Put utility functions in a custom template class and name it in the Inherits attribute of the CodeTemplate directive.
Code-behind file Base templates on a common class in a code-behind file.
Compiled assembly Compile common functions into an assembly and reference it with an Assembly directive.
Source file Put common functions in a source file and compile it with the template by using the Src attribute of an Assembly directive.
Sub-templates Move shared generation logic into sub-templates that other templates render.
Include statement Pull a source file directly into the template with an include statement.