Friday, December 10, 2010
Could not load file or assembly 'Telerik.Web.UI, Version=, Culture=neutral, PublicKeyToken=' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


When using Telerik Rad Controls for asp.net you may encounter assembly reference exceptions when using a more recent version of RadControls against a website compiled using an older version of Rad Controls.
Traditionally to resolve this problem one would download the latest Rad Controls and re-compile the project and publish this to the live environment.
There is a simpler fix however, one that bypasses the need to recompile each website and its done be specifying a runtime configuration element in your web.config file.

Here is the code. Remember to set the newVersion attribute to the version of Rad Controls for ASP.NET that you are using.

<
runtime>
    <
assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <probing privatePath="bin;" />
      <
dependentAssembly>
        <
assemblyIdentity name="Telerik.Web.UI" culture="neutral" publicKeyToken="121fae78165ba3d4" />
        <
bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2010.1.519.35"/>
      </
dependentAssembly>
    </
assemblyBinding>
</
runtime>

This web.config configuration informs the asp.net runtime to use your latest version of Rad Controls even if the project was compiled against an older version.