Particular/ServiceMatrix — pull request #397 by fsimonazzi (2014-08-05 16:52:44+00:00)
Title: Version based template selection

Removes explicit version-specific automation configuration. Instead, code-generation commands can figure out at runtime which template they need to use based on the version of NSB being targeted.

At startup the extension reads all the available tt files, parses the names and figures out which templates are version specific. The path of the template configured in the code-generation command is used as a "base template name" for lookup purposes, and if the are version-specific templates for that base name the code-generation command becomes version aware and will choose the right template before executing, while commands with no version-specific templates will use the template path they are configured with as the actual template to use.

Example:

if the following templates are deployed:
```
T\T4\T1.tt
T\T4\T2.v4.0.tt
T\T4\T2.v5.0.tt
```

And the following code generation commands are configured:
```
C1: T\T4\T1.tt
C2: T\T4\T2.tt (_note, not an actual template file path_)
```

When executed, C1 will allways use T\T4\T1.tt as its template, but C2 will use T\T4\T2.v4.0.tt or T\T4\T2.v5.0.tt depending on the NSB version.

The current version is injected on the commands through the TargetNsbVersion property on the command, which currently is set to whatever the application's version is. All code-generation commands are configured with the application's version, so converting an existing command into a version-specific one only requires adding version-specific templates to it instead of keeping the original non-versioned template.

The first commit includes the overall implementation, which uses regexes to figure out the matching template. The second commit uses Version objects instead.

We may want to fine-tune the template selection logic. Currently the templates are sorted from higher to lower version, and the first template with a version lower or equal to the current version and with the same major version, and will consider not finding a matching template an error and no code generation occurs. If not having a template for a given version is considered an expected situation, this error can be changed into a warning or an info trace.