ScriptManager is ambiguous in the namespace System.Web.UI

ScriptManager is ambiguous in the namespace System.Web.UI

Recently, I came across this issue while working with one of the ASP.NET application. So thought of sharing the solution to resolve this error.

ScriptManager is ambiguous in the namespace System.Web.UI #scriptmanager #error #aspnet Click To Tweet

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

ScriptManager is ambiguous in the namespace System.Web.UI

ScriptManager is ambiguous in the namespace System.Web.UI

The Problem

The root cause is due to referencing the old System.Web.Extensions DLL either directly or indirectly.

The Resolution

Check your web.config file and search your application for “System.Web.Extensions”. Also, make sure the old version is not in your bin folder (and does not get copied there).

Make sure you are not using any other libraries that use the old System.Web.Extensions DLL, for example, the AJAX Toolkit 1.0.x.

You need to comment out or remove the old references to System.Web.Extensions and System.Web.Extensions.Design and add in .NET Framework 3.5 in your web.config.

Here, is the xml which needs to be commented out.


<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<!--
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
-->
</assemblies>

To prevent these DLLs from being added back, you’ll need to remove all those 1.0 versions from the GAC using gacutil.

Problem not solved?

If the above stated method doesn’t solve your problem, then you can refer to below link:

  • In most of the cases the above states solution would work. If it doesn’t, then here is a link covering other scenarios as well.

Reference

What do you think?

Dear Reader,
If you have any questions or suggestions please feel free to email us or put your thoughts as comments below. We would love to hear from you. If you found this post or article useful then please share along with your friends and help them to learn.

Happy Coding!