Add template properties

CodeSmith Generator uses Property directives to define a template's metadata. Add one Property directive for each piece of information you want to collect from the user when the code is generated.

Add these Property directives after the CodeTemplate directive in AssemblyInfo.cst:

<%@ Property Name="Author" Type="System.String" Description="Lead author of the project." %>
<%@ Property Name="Title" Type="System.String" Description="Title of the project." %>
<%@ Property Name="Description" Type="System.String" Description="Description of the project." %>
<%@ Property Name="Configuration" Type="System.String" Default="Debug" Description="Project configuration." %>
<%@ Property Name="Company" Type="System.String" Default="MegaUtilities, Inc." %>
<%@ Property Name="Product" Type="System.String" Description="Product Name." %>
<%@ Property Name="Version" Type="System.String" Default="1.0.*" Description=".NET assembly version." %>
<%@ Property Name="FileVersion" Type="System.String" Default="1.0" Description="Win32 file version." %>

Each property has:

Attribute Purpose
Name The name you use to refer to the property in template code.
Type The property's .NET type. These are all strings.
Default Optional. The value the property starts with.
Description Optional. Shown in the property sheet when the user selects the property, to help them enter the right value.

Next, connect these properties to the places in the template where their values belong.

Next: Use properties in the template