How to do it: Specify where the common language runtime can find an assembly

How to do it
Table of Contents

Sometimes the location of an assembly must be explicilty indicated to the runtime.

An elegible scenario would be if two different assemblies requires different versions of the same assembly to coexist in the application runtime: In this case two distinct directories must be configured otherwise at compile time the assemblies will override each other in the target compilation directory


If the assembly has a strong name, the codebase attribute can be anywhere on the local intranet or the Internet.

If the assembly is a private assembly, the codebase attribute must be a path relative to the application’s directory.

Specify where the runtime can find a specific assembly via configuration file
How to do it

In the sample presented next:

  • each time the some class/method of the assembly “log4net, version invoked, then  the runtime will locate the assembly on directory “bin\lib\log4net_1.2.10″ and will load it;
  • each time the some class/method of the assembly “log4net, version invoked, then  the runtime will locate the assembly on directory “bin\lib\log4net_1.2.11″ and will load it;
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <!--log4net bindings for nhibernate -->
        <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" />
        <codeBase version="" href="bin\Lib\log4net_1.2.10\log4net.dll" />
      <!--log4net bindings for umbraco -->
        <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" />
        <codeBase version="" href="bin\Lib\log4net_1.2.11\snk\log4net.dll" />