Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference to multiple version assembly

Tags:

I'm developing a Sharepoint application and use .NET AjaxControlToolkit library, we are adding a custom aspx page to the Sharepoint. Sharepoint 2007 run in quirks mode so I've made some modification to the AJAX library to make it behave like it normally should. The problem is, the other team already uses the AJAX library and it is a different version with mine. This caused conflict because there could be only one dll in the bin folder with the same name.

From what I know, .NET should be able to handle this situation easily. I've tried using a strong name and GAC to solve it, but it still refers to the dll in the bin folder. If there is no AjaxControlToolkit.dll in the bin folder, the application will simply fail to load the assembly.

If I use complete assembly information on my like this

<%@ 
    Register 
    tagprefix="AjaxControlToolkit"
    namespace="AjaxControlToolkit"
    assembly="AjaxControlToolkit, Version=1.0.299.18064, 
    PublicKeyToken=12345678abcdefgh, 
    Culture=neutral"
%>

It gives me Compiler Error CS0433

Can someone help me on how to use multiple version of assembly in an application?

like image 761
Fajar Avatar asked Aug 07 '08 16:08

Fajar


1 Answers

Well the link for Compiler Error CS0433 makes it pretty clear that the core issue is not with multiple versions of the assembly being referenced - but with namespace + typename conflicts.

When you load up / reference a type - the compiler can't resolve which DLL to load that type from. If Sharepoint is going to load both your DLLs versions (as you say it needs to) - this error will always come.

Simplest fix would be to change the namespaces in the new DLL, since it does have your custom tweaks, and you control the code - mark it clearly as well.

like image 164
Vivek Avatar answered Oct 01 '22 19:10

Vivek