Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can use the Assembly directive to reference an external assembly from a template, or to include a source file for dynamic compilation. For example, CodeSmith ships Generator ships with an assembly named CodeSmith.CustomProperties.dll that includes custom editors for file names and string collections. If you'd like to use one of these editors from your own template's property sheet, you need to reference the assembly:

...

Info

The source code for the CustomProperties assembly is in the SampleProjects folder Sample folder (E.G., Documents\CodeSmith Generator\Samples\<Version>\Projects\CSharp\CustomPropertiesSample) of your CodeSmith Generator installation.


Info

All transitive dependencies must also be referenced.

Assembly Directive Attributes

There are two attributes that you can supply to the Assembly directiveAssembly directive. You must supply one or the other, but not both.

...

The Name attribute specifies the file name of an assembly to reference from the current template. The assembly must exist in the Global Assembly Cache, in the same directory as CodeSmith, in the CodeSmith\bin directory, in the CodeSmith\AddIns directory, or you can specify a path relative to the template location. If you're working with templates within CodeSmith StudioGenerator, the preferred location is the CodeSmith\AddIns directory.

Info
You can also specify the Assemblies FullName (E.G., ExampleAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)
Src

The Src attribute specifies the relative path to a source file that should be dynamically compiled along with the template.

...