Table of Contents

Class AssemblyDiscoveryHelper

Namespace
CMS.Core
Assembly
CMS.Core.dll

Provides loading of application assemblies.

public static class AssemblyDiscoveryHelper
Inheritance
object
AssemblyDiscoveryHelper

Remarks

This API supports the framework infrastructure and is not intended to be used directly from your code.

Methods

GetAssemblies(bool)

Returns an enumerable collection of application assemblies.

public static IEnumerable<Assembly> GetAssemblies(bool discoverableOnly)

Parameters

discoverableOnly bool

A value indicating whether the discovery process will locate only assemblies decorated with the AssemblyDiscoverableAttribute attribute.

Returns

IEnumerable<Assembly>

An enumerable collection of application assemblies.

Remarks

The discovery process looks for assemblies in the directories that the assembly resolver probes. By default, all the application assemblies are returned, but there are exceptions.

  1. If the discoverableOnly is set to true, assemblies without the AssemblyDiscoverableAttribute attribute are excluded from discovery.
  2. If there is a file with the "exclude" extension, for example MyCustomAssembly.dll.exclude, the MyCustomAssembly.dll is excluded from discovery.
  3. Assemblies from the GAC are always excluded from discovery.

GetAssembliesFilePaths()

Returns an enumerable collection of file paths to all assemblies in the directories that the assembly resolver probes.

[Obsolete("Method was not intended for public use and will be removed in the next version.")]
[ObsoleteSince(28, 4)]
public static IEnumerable<string> GetAssembliesFilePaths()

Returns

IEnumerable<string>

An enumerable collection of file paths to all assemblies in the directories that the assembly resolver probes.

Remarks

The assembly resolver probes for assemblies in the application directory. If the application setup includes a list of search paths relative to the application directory, the assembly resolver probes for assemblies only in the specified subdirectories. A web application is a good example as its setup includes a relative path to the bin subfolder.

IsAssemblyDiscoverable(string)

Returns true if the given assembly is discoverable.

[Obsolete("Method was not intended for public use and will be removed in the next version.")]
[ObsoleteSince(28, 4)]
public static bool IsAssemblyDiscoverable(string filePath)

Parameters

filePath string

Assembly file path

Returns

bool

RegisterAdditionalAssemblies(params Assembly[])

Register additional assemblies for which module discovery will execute.

public static void RegisterAdditionalAssemblies(params Assembly[] assemblies)

Parameters

assemblies Assembly[]

Remarks

This method is not intended to be used in custom code.

Assemblies have to be registered before application pre-init.

Exceptions

InvalidOperationException

Thrown when method is called after application pre-init.