Inheritance support in CodeSmith Templates

CodeSmith support rich inheritance among its templates. Just like ASP.NET use CodeTemplate’s ‘src’ and ‘Inherits’ attributes.  See following example.

TemplateA.cst

TemplateA

BaseTemplate.cst.cs

BaseTemplate

Advertisements

Codesmith’s .NET 4 Support

Reading .NET 4 assemblies from codesmith Template

Although CodeSmith future version  will support .NET 4 out of box, current version does not support it directly. If your template needs to read from a .NET 4 assembly, embed start-up element in your CodeSmith config files (Configuration files are located on the Installation folder).

<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>

If you want to use .NET 4 features in your templates, you can change from CompilerVersion=”v3.5″ to CompilerVersion=”v4.0″