Executing Templates
To execute a template from CodeSmith Explorer, double-click the template, or right-click the template and select Execute. You can also drag the template from CodeSmith Explorer and drop it on any application that supports drag-and-drop (including Visual Studio) to generate code at the location where you dropped the template. Any of these actions will open the template's property sheet. The template's property sheet shows you all of the properties that you can set for this template. Properties can be required or optional. You need to supply values for all required properties before CodeSmith can generate the code for you. Depending on how a property is defined in the template, you may be able to type in an arbitrary value, select a value from a predefined list, or choose a value by navigating to a dialog box from a builder button within the property sheet. Properties may also have default values. As you select each property, a description will appear at the bottom of the property sheet to tell you more about that property.
In the screenshot above, the user has selected the SourceCommand property, and the description indicates that this property specifies the Command that the wrapper class should wrap. With the property selected, the right side of the property sheet shows the builder button (with three dots). Clicking this button will open a separate dialog box (in this case, a dialog box supplied by CodeSmith's own SchemaExplorer metadata extension) to help you pick a value for this property.
When you've finished setting properties for the template, you're ready to generate code. To do this, click the Generate button at the bottom of the template's property sheet. CodeSmith will take the property values that you entered and combine them with the template to create the code, and display it in an expanded window. The code will be selected so that you can copy it to the clipboard with a single click of Ctrl+C, or by clicking the Copy Template Output toolbar button in the output window.
Tip: By default, the properties in the property sheet are sorted by categories. If you'd prefer them in a single alphabetical list, click the Alphabetic toolbar button at the top of the property sheet.
Advanced: Using a CodeSmith Project to Execute CodeSmith Templates from Anywhere