Question

Here's the errors (read the bit after before pointing out how many times this has been asked/answered!)

Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0433: The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both 'c:\WINDOWS\assembly\GAC\CrystalDecisions.Web\9.1.3300.0__692fbea5521e1304\CrystalDecisions.Web.dll' and 'c:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.Web\13.0.2000.0__692fbea5521e1304\CrystalDecisions.Web.dll'

---

Source File: c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\dev_worksordersreporting\3b24818a\20239033\App_Web_bylocation.aspx.cdcab7d2.ijxcitnu.0.cs    Line: 905 

There's a lot of these questions on here (this is closest), and the general solution seems to be to remove the older version from GAC. My situation is that our appserver has multiple versions on it and has multiple applications currently running correctly utilising the different versions. I've found the source code for one of the more recent applications referencing 13.0.2 and it is doing so in standard way (no local copy in bin).

So why can that one work and my one not? Removing older versions from GAC is not an option as they are in use.

UPDATE: Comment from Steven V mentioned assembly redirection at the app level. That was being used by working application so I added to mine but still same error. It looks like it should work so it could still be something around this that I'm doing wrong. Here's the section (under configuration) from working web.config file that I was missing:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="CrystalDecisions.Web" culture="" publicKeyToken="692FBEA5521E1304" />
            <bindingRedirect oldVersion="9.1.3300.0" newVersion="13.0.2000.0" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>

So I guess the question now is: Why isn't the assembly redirection working?

Was it helpful?

Solution

This has kinda split into 2 questions really, the original workaround for conflicting assembly versions and then the issue of assembly redirection not working. Since it looks like assembly redirection is the answer to the original question (as pointed out by Steven V in comments) I will mark question as answered and open another one on why the implementation of assembly redirection is not working.

Thanks to Steven V for nudging me in the right direction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top