Viewing the compiled template source code

When you generate or compile a template, CodeSmith Generator turns it into source code and compiles that into an assembly. When you're tracking down a problem, it can help to see that source code.

In Visual Studio:

  1. In Solution Explorer, right-click the template and click Properties.

  2. Set the Custom Tool property to TemplateSourceGenerator.

    Visual Studio Properties window with Custom Tool set to TemplateSourceGenerator

  3. In Solution Explorer, a file ending in .g.cs or .g.vb now appears under the template, as a DependentUpon file. For example, a C# template named Template.cst gets Template.g.cs.

  4. Open that file to view the compiled template source code.