Assembly Scanning Changes in NServiceBus Version 6

Component: NServiceBus

This is part of the NServiceBus Upgrade Guide from Version 5 to 6, which also includes the following individual upgrade guides for specific components:

Feature Details
Transports
Persistence
Hosting
Other

Nested directories not scanned by default

The default behavior of version 6 is to not scan nested directories for assemblies. This behavior can be re-enabled using the assembly scanning API.

Scanning uses an "exclude" approach

The API has been changed to an "exclude a list" approach. See Assemblies to scan for more information.

6.x NServiceBus
var scanner = endpointConfiguration.AssemblyScanner();
scanner.ExcludeAssemblies(
    "BadAssembly1.dll",
    "BadAssembly2.dll");
5.x NServiceBus
var excludesBuilder =
    AllAssemblies.Matching("NServiceBus")
        .And("MyCompany.")
        .Except("BadAssembly1.dll")
        .And("BadAssembly2.dll");
busConfiguration.AssembliesToScan(excludesBuilder);

Related Articles


Last modified