<assemblyBinding> Element
Contains information about assembly version redirection and the locations of assemblies.
<configuration>
<runtime>
<assemblyBinding>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705">
</assemblyBinding>
Required Attribute
Attribute | Description |
---|---|
xmlns | Specifies the XML namespace required for assembly binding. Use the string "urn:schemas-microsoft-com:asm.v1" as the value. |
appliesTo | Specifies the runtime version the .NET Framework assembly redirection applies to. This optional attribute uses a .NET Framework version number to indicate what version it applies to. If no appliesTo attribute is specified, the <assemblyBinding> element applies to all versions of the .NET Framework. The appliesTo attribute was introduced in .NET Framework version 1.1; it is ignored by the .NET Framework version 1.0. This means that all <assemblyBinding> elements are applied when using the .NET Framework version 1.0, even if an appliesTo attribute is specified. |
Child Elements
Element | Description |
---|---|
<dependentAssembly> | Encapsulates binding policy and assembly location for an assembly. Use one <dependentAssembly> tag for each assembly. |
<probing> | Specifies subdirectories the common language runtime searches when loading assemblies. |
<publisherPolicy> | Specifies whether the runtime applies publisher policy. |
<qualifyAssembly> | Specifies the full name of the assembly that should be dynamically loaded when a partial name is used. |
Example
The following example shows how to redirect one assembly version to another and provide a codebase.
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
<codeBase version="2.0.0.0"
href="http://www.litwareinc.com/myAssembly.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
The following example shows how to use the appliesTo attribute to redirect binding of a .NET Framework assembly.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705">
<dependentAssembly>
<assemblyIdentity name="mscorcfg" publicKeyToken="b03f5f7f11d50a3a" culture=""/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="1.0.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Configuration File
This element can be used in the application configuration file, machine configuration file (Machine.config), and the publisher policy file.
See Also
Runtime Settings Schema | Configuration File Schema | Redirecting Assembly Versions