Two different version of ajaxtoolkit dll in same web application

Have you ever get one of the following error?

Error#1:
The server tag ‘ajaxControlToolkit:ControlX‘ is ambiguous. Please modify the associated registration that is causing ambiguity and pick a new tag prefix.
Error #2:
ControlX‘ is ambiguous in the namespace ‘AjaxControlToolkit’.
If you are getting Error#1, that’s because you have two different version of AjaxControlToolkit assembly reference in either web.config or page level(using @Register Assembly attribute).
For example, if you have following in web application’s web.config
<controls>

<add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=3.5.11119.20050, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" tagPrefix="ajaxContrlToolkit"/>

<add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=1.0.20229.20821, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" tagPrefix="ajaxControlToolkit"/>

</controls>

You can NOT have a same tagPrefix(here in this example ‘ajaxControlToolkit’) for two different version of same assembly.  So if you set different tagPrefix, you will end up getting Error #2.

The reason is that you can NOT run two different version of AjaxControlToolkit dll or any assembly in same web application.  It would work if you have two different web application and both are referencing different version.

There is one work around for that if you have a source code of that DLL.  Open up the source code(if you are using AjaxControlToolkit DLL, you can download the source code here.).  You can change the name of DLL and also change namespace that’s being used in source code.  I know that you would hate this solution(specifically you are using AjaxControlToolkit dll) but there is no choice either upgrade your current web application to use only one version of that DLL or change the source code to compile into different assembly name.

Hope that helps you!!!

Posted in Microsoft Technology Tagged with:
One comment on “Two different version of ajaxtoolkit dll in same web application
  1. hi says:

    hi how can i use a assembly in a page.the assembly may not be in the bin folder.

Ads