DllImportSearchPath Enumeration

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Specifies the paths that are used to search for DLLs that provide functions for platform invokes.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

public enum DllImportSearchPath

Member nameDescription

Include the application directory in the DLL search path.


When searching for assembly dependencies, include the directory that contains the assembly itself, and search that directory first. This value is used by the .NET Framework, before the paths are passed to the Win32 LoadLibraryEx function.


Search the application directory, and then call the Win32 LoadLibraryEx function with the LOAD_WITH_ALTERED_SEARCH_PATH flag. This value is ignored if any other value is specified. Operating systems that do not support the DefaultDllImportSearchPathsAttribute attribute use this value, and ignore other values.


Include the application directory, the %WinDir%\System32 directory, and user directories in the DLL search path.


Include the %WinDir%\System32 directory in the DLL search path.


Search for the dependencies of a DLL in the folder where the DLL is located before searching other folders.


Include any path that was explicitly added to the process-wide search path by using the Win32 AddDllDirectory function.

Use the DefaultDllImportSearchPathsAttribute attribute to apply a set of paths to an entire assembly or to an individual platform invoke.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top