25

The full error is

The base class includes the field 'ScriptManager1', but its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager).

Anyone else come across this error?

Nathan Smith
  • 683
  • 1
  • 10
  • 24
Collin Estes
  • 5,577
  • 7
  • 51
  • 71
  • Seems to be a duplicate. Reference Mitchell's answer here: http://stackoverflow.com/questions/582492/working-with-vs2008-3-5-asp-ajax-site-on-a-2-0sp1-ajax-extesnion-1-0-server – Ian Robinson Feb 24 '09 at 17:14

12 Answers12

38

I managed to fix it by adding this to web.config:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

I believe it forces the .net runtime to use the new versions of those assemblies.

MGOwen
  • 6,562
  • 13
  • 58
  • 67
7

I've run into this issue when upgrading a web application from .NET 2.0 to 3.5.

Check your web.config is correctly set for .NET 3.5. I added/changed the following:

  <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

      <assemblies>
        <!--<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>-->
        <add assembly="System.Core, 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.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>

   <httpHandlers>
        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
        <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
   <httpHandlers>



        <pages enableSessionState="true" validateRequest="true">
            <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            </controls>
        </pages>

    <httpModules>
  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </httpModules>

Daniel Ballinger
  • 13,187
  • 11
  • 69
  • 96
2

Adding the <runtime> section above fixed the problem on our dev machines and test server, but not our live servers.

It turns out that if your web.config file contains an xmlns attribute of xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" then you will get a GAC conflict:

BAD.web.config
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
etc

but this version from the devt machine is fine:

GOOD.web.config
<?xml version="1.0"?>
<configuration>
etc

So make sure that 2.0 reference is removed from the top of your web.config file.

Nathan Smith
  • 683
  • 1
  • 10
  • 24
JimBGood
  • 21
  • 1
1

We had a very similar problem. The development platform worked fine but once the site was deployed to the testing site it broke with the same message as the original poster above. We had subdirectories under our controls directory to group user controls together. The problem appeared to be a control in the subdirectory trying to use a control in the directory above it. Our first fix was to clone the toplevel control to the subdirectory. We then hit on the idea of creating a parallel sibling subdirectory and parking the control there. That fixed the problem without having to resort to (a) flattening our controls directory structure or (b) clone the same control in various subdirectories.

So our solution is to never refer to a control in a parent directory from a user control in a subdirectory.

I hope this helps out.

  • My problem (quite some years later!) seems to have been this, between aspx and ascx files in various folders. It was particularly gnarly because the error was not reported about code I had just changed -- it seems I already had the somewhat unnatural dependency from folder UserControls/Y to folder X, and I added a new dependency from X to UserControls/Y. The compiler tried to work around it by making extra DLLs like `App_Web_MyControl.ascx.463b83aa.dll` next to the `App_Web_0wdaov4p.dll` lot, but I got this error on deployment. An archived KB article: https://mskb.pkisolutions.com/kb/919284 – Paul Stephenson Jan 17 '22 at 15:45
1

You can also solve this problem in the .vbproj file (in my case). Check for these entries:

<Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
  <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
  <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>

This seems to also force the use of the 3.5 version DLLs.

Brice D
  • 11
  • 1
0

"The base class includes the field 'ScriptManager1', but its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager)."

Anyone else come across this error?

I have had that kind of error several times, though not specifically with scriptmanager. Basically it happens when you have a control of one type on the page. And lets say you were idle for sometime. But then you deleted the control and put another one in its place with the same ID, that is when it can occur. I believe it is related to or created by an out of date aspx.designer.cs.

To fix the problem. I have either had to change the name of the ID of the control, or rebuild the solution. I think there's another way too. I think if you have a aspx.designer.cs file of the name of the aspx file you can change it in there as well.

Community
  • 1
  • 1
Alexander Ryan Baggett
  • 2,347
  • 4
  • 34
  • 61
0

This can also be resolved by changing the project reference to System.Web.Extensions 1.0.61025 or other version, Make sure the project reference, web config and the ajax toolkit all match the same version.

Pankil
  • 1
0

We had this same problem when precompiling our application from the command line using the "Application is updatable" flag:

aspnet_compiler.exe -u

removing the -u flag solved this issue. Don't ask me why!

JordanC
  • 4,339
  • 1
  • 22
  • 16
0

After reading the answers here, I figured the problem was in how IIS is compiling the controls, using the wrong version. I fixed this problem by updating the production web.config: Under <system.web> add <httpRuntime targetFramework="4.5.1" />

Busch4Al
  • 53
  • 4
0

Very similar issue. "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is ..." changed markup files from CodeFile= to CodeBehind=

Maslow
  • 18,464
  • 20
  • 106
  • 193
0

in my case, just switched the build framework from 2.0 to 3.5.

This is done by right clicking on the project name (top of solution explorer) and select "Property Pages". from there, select build option and change the framework.

It should update web.config and all needed references.

HTH

Dave

Dave
  • 740
  • 1
  • 6
  • 17
0

Had a similar problems updating from 3.5 to 4.0. In my case, there is a root website, and virtual IIS application directories underneath this.

The code worked fine in my development and staging areas.

As soon as it went onto the production server, it crashed. Even though the code was the same.

My solution was to delete the virtual directory and recreate it. Making sure that the application pool is correct, and the asp.net version is correct. (my servers are Windows server 2003 with IIS6).

One other important note - you cannot run multiple asp.net versions in the same application pool.

jagdipa
  • 420
  • 1
  • 5
  • 18