Skip to main content
Version: 2024.2

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:

7.6.1. Syntax

Assembly mask syntax is equivalent to glob mask syntax:

Table 7.4. The list of available wildcard characters

Wildcard

Description

?

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. See the examples.

When an assembly mask starts with ^ and ends with $ characters, it is switched to regex mask mode.

7.6.2. Behavior

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.

Case Sensitivity

Assembly mask is case-insensitive.

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 hierarchy levels, like so:

  • Contoso.QuickRun.Engine.dll
  • Contoso.QuickRun.Engine.Contracts.dll - the contract module of Engine subsystem 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

Considering the convention, what should a mask like Contoso.QuickRun.Engine.*.dll select? Should it only select the submodules of Engine subsystem, or should it include the "root" 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 natural to select .NET assemblies by interpreting the structural meaning of a pattern [1] using de facto .NET assembly naming conventions.

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 symbol). 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.

7.6.3. Examples

Table 7.5. Assembly mask examples

Assembly Mask

Description

ABC*.dll

Matches any assembly with a name starting with "ABC" and ending with ".dll"

A.*.dll

Matches any assembly with a name starting with "A." and ending with ".dll", including "A.dll"

A.?*.dll

Matches any assembly with a name starting with "A." and ending with ".dll", but not "A.dll"


[1] Hierarchal naming convention is followed when the compatibility version is 2021.4+.