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 v126.96.36.199). My new machine has the latest version of the assembly installed, so I thought I'd updated it (lets call the new version v188.8.131.52).
Now here's the problem: If I copy the old v184.108.40.206 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 (v220.127.116.11), 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)
Clearly, the code is looking for the out of date version and can't find it. But why?
I greped the solution folder for that version number and couldn't find a single reference. I double checked the text of the .csproj file and found the version correctly shows the latest version and the HintPath correctly shows the path to the new DLL. Furthermore, because I didn't install the old DLL on the system it doesn't show up in my GAC (though v18.104.22.168 does, as expected).
I then enabled the fusion log viewer to try to figure out why it's looking for that old version, but no luck:
Assembly Load Trace: The following information can be helpful to determine why the assembly 'XXXXXX, Version=22.214.171.124, Culture=neutral, PublicKeyToken=121fae78165ba3d4' could not be loaded. === Pre-bind state information === LOG: User = MyComp\me LOG: DisplayName = XXXXXX, Version=126.96.36.199, Culture=neutral, PublicKeyToken=121fae78165ba3d4 (Fully-specified) 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=188.8.131.52, 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=184.108.40.206, 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.
All it says it that it starts by looking for that old assembly. I have tried to find a solution online and saw this similar SO question, but it seems to be the exact opposite of my problem. That questioner's program was finding the wrong DLL instead of the referenced one. Whereas my problem is that the program is mysteriously looking for the wrong DLL and unable to find it when the right one can be found locally in the bin folder and in the GAC.
Why is mine looking for the old version? Where else can I search to find this bad reference?