NativeLibrary.SetDllImportResolver(Assembly, DllImportResolver) NativeLibrary.SetDllImportResolver(Assembly, DllImportResolver) NativeLibrary.SetDllImportResolver(Assembly, DllImportResolver) Method

Definition

Sets a callback for resolving native library imports from an assembly.

public:
 static void SetDllImportResolver(System::Reflection::Assembly ^ assembly, System::Runtime::InteropServices::DllImportResolver ^ resolver);
public static void SetDllImportResolver (System.Reflection.Assembly assembly, System.Runtime.InteropServices.DllImportResolver resolver);
static member SetDllImportResolver : System.Reflection.Assembly * System.Runtime.InteropServices.DllImportResolver -> unit

Parameters

assembly
Assembly Assembly Assembly

The assembly for which the resolver is registered.

resolver
DllImportResolver DllImportResolver DllImportResolver

The resolver callback to register.

Exceptions

assembly or paramref name="resolver" /> is null.

A resolver is already set for this assembly.

Remarks

This per-assembly resolver is the first attempt to resolve native library loads initiated by this assembly.

Only one resolver can be registered per assembly. Trying to register a second resolver fails with an InvalidOperationException.

Applies to