ActiveSnippet Configuration

The ActiveSnippet Configuration can be accessed by selecting the ActiveSnippet Configuration menu item located in the Visual Studio Generator sub-menu. The ActiveSnippet Configuration dialog allows you to Add, Remove, Edit or view all ActiveSnippets, Once you've created a template for usage as an ActiveSnippet, you must add the ActiveSnippet which maps to a CodeSmith Generator Template.

Adding a new ActiveSnippet

The first step to creating a new ActiveSnippet is to click the Add button, and use the Template Chooser Window to browse to the CodeSmith Generator template that will be serving as your ActiveSnippet. Once you select the template, you must configure at minimum the Template Options for the template.

Template Options

The template options tab holds the mapping information about your CodeSmith Generator template. This information is required to allow you to have access to this template from within Visual Studio.

Template: The full path to the CodeSmith Generator template.

Alias: The ActiveSnippet Alias is the command to be used as the alias representing the selected CodeSmith Generator template.
Description: Specifies the friendly name description of the ActiveSnippet. It will be shown during the Output Usage information.
Target Extensions: The template target language is used as a hint for ActiveSnippets that have the same name.
Template Language: The template language shows the selected CodeSmith Template Output Language.

Argument Mapping

Configuring the arguments for an ActiveSnippet is a powerful feature because it does not force you to have to always pass all properties in for the selected CodeSmith Generator Template as arguments.

This tab is a dual pane select box which shows all template properties to the left, and all arguments to the right. Control arrows are used to move properties to and from the Arguments window. The up and down arrows are used to setup the argument order of the ActiveSnippet.

Template Properties Box: A window of all the property names in a template.
Arguments Box: A window of all the arguments that will be required to use your ActiveSnippet

Default Property Values

The Default Property Values tab will allow you to enter possible default values for your CodeSmith Generator Templates' Property Sheet. This will show all the properties for the ActiveSnippet based CodeSmith Generator Template.

Values that you want to be required properties for ActiveSnippet arguments would not be filled in as a default value.