7.6. Assembly Mask
Assembly mask is a text pattern format designed for .NET assemblies selection. It is based on glob mask format but contains behavioral alterations to make the process of assembly selection more natural. Assembly mask is supported by the following features:
Assembly mask syntax is equivalent to glob mask syntax:
Table 7.4. The list of available wildcard characters
Matches a single character
Matches any number of characters, including zero
Wildcard characters are combined into a string to form an assembly mask with the desired properties.
When an assembly mask starts with
^ and ends with
$ characters, it is switched to regex mask mode.
Assembly mask differs from the glob mask in semantic behavior in order to accommodate the de jure and de facto conventions of .NET assembly naming.
Hierarchal Naming Convention
Let's take a look at
Contoso.QuickRun.Engine.dll assembly name. It represents a hierarchal assembly name where
Contoso is a company name,
QuickRun is a product name, and
Engine is a subsystem name. The naming may then descend into deeper hierarchical levels, like so:
Contoso.QuickRun.Engine.Contracts.dll- the contract module of
Enginesubsystem of the product
Contoso.QuickRun.Engine.Dal.dll- the data access layer of the engine
Contoso.QuickRun.Engine.Integration.B2B.dll- B2B integration facilities of the engine
What should a mask like
Contoso.QuickRun.Engine.*.dll select? Should it only select the submodules of
Engine subsystem, or should it include
Contoso.QuickRun.Engine.dll assembly as well, thus covering the whole semantical scope? Glob mask would select only the submodules, but assembly mask selects
Contoso.QuickRun.Engine.dll assembly as well, and that is a conceptual difference between the two. Assembly mask makes it more handy to select .NET assemblies by interpreting the structural meaning of a pattern .
If such interpretation is not desired, the following assembly mask can be used instead:
Contoso.QuickRun.Engine.?*.dll (note the question mark before the star). It mandates that there should be at least one character at the beginning of the string that follows after
Contoso.QuickRun.Engine. prefix and before
.dll suffix. Such mask matches the submodules only and does not include
Contoso.QuickRun.Engine.dll in the result.
Assembly mask is case-insensitive.
Table 7.5. Assembly mask examples
Matches any assembly with a name starting with "ABC" and ending with ".dll"
Matches any assembly with a name starting with "A." and ending with ".dll", including "A.dll"
Matches any assembly with a name starting with "A." and ending with ".dll", but not "A.dll"