Search code examples
.netassembliesgaccsla

how do you add multiple versions of the same assembly to the gac


My one ASP.NET web site uses two different business object class libraries. There is a common framework DLL (CSLA.dll) between these two libraries. The problem is that one library wants to upgrade to CSLA v.4.0.1 and the other wants to remain at v.2.1.4.

How do I solve this conflict at the web site? I think I need to install both versions of the CSLA into the GAC, but I don't know how to do two things

  1. Add different versions of the same DLL to the GAC (I have used gacutil -i on both CSLA.dlls. I see CSLA.dll 2.1.4 in the .NET Configuration 2.0 tool, but I see CSLA.dll 4.0.1 in C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\Csla
  2. Make the web site reference the two different versions

Thanks in advance for your help


Solution

  • In response to:

    Make the web site reference the two different versions

    You can force your application to use a specific version of an assembly by using Assembly Binding Redirection:

    In your case, the configuration should go in your web.config since the redirection is application-specific and doesn't apply to an entire version of the framework.