Static Content in the Template

Adding static content to a CodeSmith Generator template is easy. If CodeSmith Generator sees something in the template that it doesn't recognize as dynamic scripting content, it copies that content directly to the template's output. So the first step in building our new template is to tack the existing file on to the template without any changes:

<%@ CodeTemplate Language="C#" TargetLanguage="C#" Description="Create an AssemblyInfo.cs file." %>
using System.Reflection;
using System.Runtime.CompilerServices;
//
// Created: 1/1/1973 
// Author: Blake Niemyjski
//
[assembly: AssemblyTitle("User storage utility")]
[assembly: AssemblyDescription("Helps manage data in Isolated Storage files.")]
[assembly: AssemblyConfiguration("Retail")]
[assembly: AssemblyCompany("MegaUtilities, Inc.")]
[assembly: AssemblyProduct("StorageScan")]
[assembly: AssemblyCopyright("Copyright (c) MegaUtilities, Inc.")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0")]
[assembly: AssemblyDelaySign(true)]

At this point, you can run the template, and you'll get output: in fact, you'll get the original file back, because there's no dynamic content in this template at all. Next, you need to modify the template to take advantage of the power of CodeSmith Generator's dynamic scripting and interactive metadata.

Next: Making the Content Dynamic