Open a template

Templates are patterns for generated code. CodeSmith Generator comes with a set of sample templates to get you started. As you work with Generator, you'll write your own templates too, and Template Explorer helps you organize them in folders so you can find and run them quickly.

Template files have the .cst extension, which stands for "CodeSmith Generator Template". Template names usually describe what they generate. In this tutorial you use CustomException.cst, which generates a C# exception class.

  1. In Template Explorer, expand the samples folder, then ActiveSnippets > CSharp. To expand a folder, click the arrow to the left of it.
  2. Double-click the CustomException template, or right-click it and select Execute.

Generator opens the template's property sheet, with the template's properties grouped into two categories: 1. Class Definition and 2. Internals.

Tip

This template is also an ActiveSnippet: inside Visual Studio you can expand it directly in a code file. In this tutorial you run it as a normal template.

Next: Set properties