Search code examples
visual-studio-2010db2asp.net-3.5gac

Add Reference pointing to a different version than GAC


In one of my websites, I have added a reference to IBM.DATA.DB2.dll (which is in GAC, version 9.0.0.2) as shown in the text below from web.config:-

But when I build my project, it tries to point it to a different version of the dll, as shown below in the error mrssage:-

"Could not load file or assembly 'IBM.Data.DB2, Version=9.7.4.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

I checked in GAC (C://Windows/Assemblies) and I cannot see any reference to version 9.7.4.4 there. I would appreciate any help I can get on this.

Thanks, Abhi.


Solution

  • I was able to solve my problem using fuslogvw.exe. From the log I found out that there was a version redirect in the machine.config file in path "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config", which was redirecting the reference 9.0.0.2 to 9.7.4.4.

    <dependentAssembly>
    <assemblyIdentity name="IBM.Data.DB2" publicKeyToken="7c307b91aa13d208" culture="" />
    <bindingRedirect oldVersion="8.0.0.0-9.0.0.4" newVersion="9.7.7.4" />
    </dependentAssembly>
    

    Changing 9.7.4.4 to 9.0.0.2 solved the probem.

    Thanks, Abhi.