Using the CodeSmith API
CodeSmith exposes the entire operation of the CodeSmith engine through an API. Through this API, you can compile templates, retrieve any errors, create instances of templates, get the generated source code, fill in template metadata, and ultimately render a template's output to a TextWriter, file, or string. This API allows you to perform many CodeSmith operations from your own code in any .NET language, and lets you programmatically execute CodeSmith templates from within your own code.
Remember, CodeSmith is licensed on a per-developer basis. If your application depends on programmatically executing CodeSmith templates, each user must have a license to use CodeSmith.
This feature is only available in the Professional Edition of CodeSmith.