This documentation is archived and is not being maintained.

DependencyAttribute Constructor

Initializes a new instance of the DependencyAttribute class with the specified LoadHint value.

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

public DependencyAttribute(
	string dependentAssemblyArgument,
	LoadHint loadHintArgument


Type: System.String
The dependent assembly to bind to.
Type: System.Runtime.CompilerServices.LoadHint
One of the LoadHint values.

The DependencyAttribute attribute gives the common language runtime hints on how tightly to bind to the dependency. The runtime uses these hints to help settle tradeoffs between lazy dependency load and efficient binding to the dependency. For example, hard binding allows the runtime to encode pointers to dependent native images, which results in a reduced working set. This attribute guides the runtime in making these decisions.

The following example specifies that the native image generation service always binds to AssemblyA and sometimes binds to AssemblyB.

using System;
using System.Runtime.CompilerServices;

[assembly: DependencyAttribute("AssemblyA", LoadHint.Always)]
[assembly: DependencyAttribute("AssemblyB", LoadHint.Sometimes)]

class Program

    static void Main(string[] args)

        Console.WriteLine("The DependencyAttribute attribute was applied.");


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.