Versions Compared

Key

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

Merge strategies are carried out by classes that implement the CodeSmith.Engine.IMergeStrategy interface. You can find the details of this interface in the CodeSmith Generator API help file.After  interface.  After defining your own merge strategy, there are two ways that you can use it. First, you can specify a fully-qualified assembly name when calling the merge strategy from the command line:

Code Block
languagehtml/xml
/merge:MyMergeAssembly.MyMergeStragegy="MergeParameters=Sample Merge Parameters;Language=C#;"

 To Also, you can register your merge strategy with CodeSmtih Generator. This allows you to refer to your merge strategy by name and not by the types FullName.

Info
Adding your merge strategy to the alias list allows you to call it by name when you use the /merge switch.

To do this, you will need to add a registry key entry to the following node:

Code Block
languagehtml/xml
HKEY_CURRENT_USER\Software\CodeSmith\

...

<VERSION>\MergeStrategyAlias

...

Code Block
\<NUMBER THAT DOESN'T EXIST (E.G., 5)>

Finally, you will need to create the following string registry values: Name and TypeName. Here is an entry of an example that ships with CodeSmith Generator, the contents of the code below is an registry export.

Code Block
languagenone
Windows Registry Editor Version 5.00
 
[HKEY_CURRENT_USER\Software\CodeSmith\v6.0<VERSION>\MergeStrategyAlias\05]
"Name"="InsertRegionPreserveRegions"
"TypeName"="CodeSmith.Engine.InsertRegionMergeStrategyPreserveRegionsMergeStrategy,CodeSmith.Engine"

...