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

后端 未结 12 1272
渐次进展
渐次进展 2021-01-03 21:16

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

相关标签:
12条回答
  • 2021-01-03 21:50

    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.

    0 讨论(0)
  • 2021-01-03 21:51

    "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.

    0 讨论(0)
  • 2021-01-03 21:54

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

    0 讨论(0)
  • 2021-01-03 21:58

    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" />

    0 讨论(0)
  • 2021-01-03 22:01

    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.

    0 讨论(0)
  • 2021-01-03 22:04

    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.

    0 讨论(0)
提交回复
热议问题