I just copied an existing project to a brand new machine to start developing on it and have run into a problem with the version of one of my referenced assemblies (a telerik DLL as it happens).
The project originally referenced an older version of the assembly (lets call it v220.127.116.11). My new machine has the latest version of the assembly installed, so I thought I'd updated it (lets call the new version v18.104.22.168).
Now here's the problem: If I copy the old v22.214.171.124 dll to the project folder and add it as a reference, the web site launches without a problem. If I delete that reference (and also delete the old DLL from my system) and add the new version (v126.96.36.199), the page shows the following exception:
Could not load file or assembly
one of its dependencies. The located
assembly's manifest definition does
not match the assembly reference.
(Exception from HRESULT: 0x80131040)
Assembly Load Trace: The following information can be helpful to determine why the assembly 'XXXXXX, Version=188.8.131.52, Culture=neutral, PublicKeyToken=121fae78165ba3d4' could not be loaded.
=== Pre-bind state information ===
LOG: User = MyComp\me
LOG: DisplayName = XXXXXX, Version=184.108.40.206, Culture=neutral, PublicKeyToken=121fae78165ba3d4
LOG: Appbase = file:///d:/My Documents/Visual Studio 2010/Projects/CoolProj/WebApp/
LOG: Initial PrivatePath = d:\My Documents\Visual Studio 2010\Projects\CoolProj\WebApp\bin
Calling assembly : WebApp, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file: d:\My Documents\Visual Studio 2010\Projects\CoolProj\WebApp\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: XXXXXX, Version=18.104.22.168, Culture=neutral, PublicKeyToken=121fae78165ba3d4
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/90233b18/10d54998/XXXXXX.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/90233b18/10d54998/XXXXXX/XXXXXX.DLL.
LOG: Attempting download of new URL file:///d:/My Documents/Visual Studio 2010/Projects/CoolProj/WebApp/bin/XXXXXX.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
My guess is that another assembly you are using is referencing the old dll. Are you familiar with all of the other project references being used and do any of them have a reference to the Telerik dlls?
Can you put in a binding redirect in your web.config file like this?
<dependentAssembly> <assemblyIdentity name="Telerik" publicKeyToken="121fae78165ba3d4"/> <bindingRedirect oldVersion="22.214.171.124" newVersion="126.96.36.199"/> </dependentAssembly>