Merge Strategies

Merge strategies answer the question: How do I customize generated code without losing my customizations when the code is regenerated?  CodeSmith offers you a choice of two different merge strategies:

CodeSmith Generator ships with various Merge Strategy sample templates that can be found in the Template Explorer under the following folder: \Examples\Merge.

Merge Strategies are supported using the CodeSmith Console Application and CodeSmith Project File to generate code. 

This feature is only available in the Professional Edition of CodeSmith.

Creating a new Merge Strategy
Merge strategies are carried out by classes that implement the CodeSmith.Engine.IMergeStrategy interface. If you like, you can create your own merge strategy by implementing this interface. To register your merge strategy with CodeSmtih Generator, you will need to add a registry entry to the following node: HKEY_CURRENT_USER\Software\CodeSmith\v5.3\MergeStrategyAlias. We will be adding an Options User Interface for this in a future version of CodeSmith Generator.