Directory Freebies VS CheatSheet Forum

RSS

Email

Translate

Home About Archive Privacy Contact Advertise Write for Dev102
Posted by Amit on Mar 21st, 2008 | Filed under ASP.Net |

A few days ago I was working on a web application and when I added a ScriptManager and a ScriptManagerProxy  to the Master Page and Although the compilation was successful. I got the following error on the designer:

‘ScriptManager’ is ambiguous in the namespace ‘System.Web.UI’,

I said to my self: ah, probably another one of the Visual Studio glitches… so I pressed F5 and was proved wrong after getting the following runtime error:

Compiler Error Message: BC30560: ‘ScriptManager’ is ambiguous in the namespace ‘System.Web.UI’

After doing some checking I actually found the following error in the output:

errorCS0433:The type ‘System.Web.UI.ScriptManager’ exists in both ‘c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll’
and ‘c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.6.0.0__31bf3856ad364e35\System.Web.Extensions.dll’

Well, that was the end, as it turns out I had installed both the Ajax that comes with the .NET 3.5 and the Ajax that comes with ASP.NET 3.5 Extensions, and I had referenced them both! All I needed to do was to remove one of the references and that’s it.

So if you have both installed, make sure you reference only one of them throughout your project.

Amit.

Tags: , , , , , , , ,

30 Responses to “Ajax ScriptManager Error BC30560”


  1. Srikanth Said on Apr 16, 2008 :

    Hi Sir,

    I am also getting the same problem.Where can i remove these reference.Can you provide the total information of this?

    Thanks,
    Srikanth

  2. Amit Said on Apr 16, 2008 :

    Hi Srikanth

    It can happen from various reasons.
    you should check you GAC (C:\WINDOWS\assembly) to see how many installations of system.web.extentions you have, and what are their versions. Check it and get back to me I will try to help.

    Amit

  3. Srikanth Said on Apr 16, 2008 :

    Hi amit,
    I have system.web.extentions 3.5.0.0,1.0.61025.0,3.6.0.0 versions.
    Actually i have installes both Ajax 3.5 and as well as ASP.NET 3.5 EXTENSIONS Controls

    Please tell solution for my problem

  4. Amit Said on Apr 16, 2008 :

    Thats the problem.
    They are both related to the same framework so the Visual Studio gets confused between them. you should remove one of them.
    I recommend staying with the 3.5.0.0 one, that is what i am using and it works fine, though i think any of them will be OK.

    Amit

  5. srikanth Said on Apr 16, 2008 :

    How can i remove the 3.6.0.0?Can i remove the total asp.net 3.5 extension tool?

  6. Amit Said on Apr 16, 2008 :

    Use this application:

    http://msdn2.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx

    it is for registering and removing dlls from the GAC

    Amit

  7. Fares Said on Apr 28, 2008 :

    Try modifying the web.config of the application,
    change the “System.Web.Extensions” assembly version from “3.6.0.0″ to “3.5.0.0″ or vice versa:

    The key will look like the following:

    <add assembly=”System.Web.Extensions, Version=3.5.0.0, …etc

    OR

    <add assembly=”System.Web.Extensions, Version=3.6.0.0, …etc

  8. Roberta Said on Jun 5, 2008 :

    I am not sure how to use this GAC to remove the extra versions. Where do I fing the Gacutil.exe. I did a search on C and did not locate it.

  9. Shahar Y Said on Jun 5, 2008 :

    Hi Roberta,

    It is usually located in C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin but you may have installed Visual Studio in a different folder. So, find the anydir:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

  10. Roberta Said on Jun 5, 2008 :

    thanks I found the file but now how do I uninstall the extra versions? I tryed though dos but that did not work

  11. Shahar Y Said on Jun 5, 2008 :

    Roerta,

    You need to drag the gacutil.exe file into the command shell (cmd) and use the options you need.

    You can read about the available options here:
    http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx

  12. Roberta Said on Jun 5, 2008 :

    Hi Shahar Y

    I did that and this is what I typed in
    C:\>”C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe”system.
    web.extensions.dll, version=1.061025.0,culture=”natural,PublicKeytoken=31bf3856a
    d364e35

    and this is what I got

    ‘”C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe”system.web
    .extensions.dll’ is not recognized as an internal or external command,
    operable program or batch file.

  13. Roberta Said on Jun 5, 2008 :

    I am not sure if this makes a diff or not but when I run the gacutil.exe /l the system.web.extensions do not show up but when I go to c:windows/assembly there are two there.

  14. Shahar Y Said on Jun 5, 2008 :

    Roberta,

    1) I see that you forgot to add a space between the gacutil.exe and your assembly name.
    2) You need to use some flag. If you want to uninstalls an assembly from the global assembly cache, you need to write - ”C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe” /u yourAssemblyName

  15. Shahar Y Said on Jun 5, 2008 :

    Hi Roberta,

    About the fact that you can’t find the system.web.extensions assembly using the /l option - try to run “gacutil.exe /l system.web.extensions” and see if it can be found.

  16. Roberta Said on Jun 5, 2008 :

    Thanks I did that:
    C:\>gacutil.exe /u “system.web.extensions, version=1.0.61025.0,culture=”natural”
    ,PublicKeytoken=31bf3856ad364e35

    this is what I get

    C:\>gacutil.exe /u “system.web.extensions, version=1.0.61025.0,culture=”natural”
    ,PublicKeytoken=31bf3856ad364e35

    is there any other way to remove this?

  17. Roberta Said on Jun 5, 2008 :

    sorry this is what I get

    Microsoft (R) .NET Global Assembly Cache Utility. Version 1.0.3705.0
    Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.

    No assemblies found that match: system.web.extensions, version=1.0.61025.0,cultu
    re=natural,PublicKeytoken=31bf3856ad364e35

    Number of items uninstalled = 0
    Number of failures = 0

  18. Roberta Said on Jun 5, 2008 :

    it is not listed in the /l at all

  19. Roberta Said on Jun 5, 2008 :

    this is what I get
    C:\>gacutil.exe /l “system.web.extensions

    Microsoft (R) .NET Global Assembly Cache Utility. Version 1.0.3705.0
    Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.

    The Global Assembly Cache contains the following assemblies:

    The cache of ngen files contains the following entries:

    Number of items = 0

  20. Shahar Y Said on Jun 5, 2008 :

    Roberta,

    1) You wrote natural instead of neutral.
    2) Not sure if it matters, but you didn’t use spaces and capital letters.
    Try to write it like that: system.web.extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

  21. Roberta Said on Jun 5, 2008 :

    ok thanks:~) I rewrote it and now it is telling me

    invalid file or assembly name
    that I need a .dll or .exe

    Just to make sure I am getting the assembly name from C:\WINDOWS\assembly is that right?

  22. Shahar Y Said on Jun 5, 2008 :

    Roberta,

    If ”C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe” /u system.web.extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 doesn’t work, it is weird and sorry but I have no ideas left…

  23. Roberta Said on Jun 5, 2008 :

    ok thanks for all your help. :~)

  24. Jeff Said on Jan 25, 2009 :

    Thanks so much! Stupid VWD 2008 adds the 3.5 reference automatically. Good old Microsoft :) Thanks again!

  25. omyfish Said on Jun 26, 2009 :

    This work for me.

    gacutil.exe /u “system.web.extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″

  26. H Selik Said on Feb 11, 2010 :

    May be there is a diffrent solution .Our web project developed on 2.0 V. then we installed upper version “3.0”,”3.5” on the machine.
    The project needed to be developed.When I drag dropped a script manager on any page of prj. then it started to fall into error. “‘ScriptManager’ is ambiguous in the namespace ‘System.Web.UI’”
    I could use this solution but we have projects that have all of versions . It could be dangerous for the other projects :)
    Then I found out there had been two lines on web config that they had contained different version informations .
    “<add assembly=”System.Web.Extensions, Version=1.0.61025.0″ And “<add assembly=”System.Web.Extensions, Version=3.5.0.0″
    I removed the last version line .But still error…
    Then I found the same lines on aspx on the top of pages. “”
    Some of them were different “Version=3.5.0.0″ . I changed the correct one. It is working now.

  27. indianbill Said on Mar 13, 2010 :

    This happend to me, after I already had a working site.
    The problem seems to be duplicate extensions. AJAX and .net

    Somehow, MS VS added an assembly definition line to my web.config file automatically while I was coding….not sure how..must have been something I did while editing the page.

    Removing this line from my web.config file fixed it for me.

    The ajax extension i’m using is…

  28. indianbill Said on Mar 13, 2010 :

    Keep this line…

    add assembly=”System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″

    Remove this one…

    add assembly=”System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″

2 Trackback(s)

  1. May 5, 2008: Chris Love's Official Blog - Professional ASP.NET : ‘ScriptManager’ is ambiguous in the namespace ‘System.Web.UI’
  2. Mar 24, 2009: Creating an Ajax Login Form With jQuery | Dev102.com

Post a Comment

Write Article for Dev102

Write for Dev102!

We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution

Learn More