"The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

Rate It (1)

Last post 12-11-2009 7:57 AM by nagappmking. 42 replies.

Sort Posts:

  • "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    02-07-2006, 2:41 PM
    • Member
      77 point Member
    • net_prog
    • Member since 02-07-2006, 7:30 PM
    • Posts 21
    Hello.

    I tried to convert a project from ASP.NET 1.1 to 2.0 and found one big problem which stops the whole process.

    An .aspx page from the subfolder "admin" includes a user control from the subfolder "common". Both subfolders ("admin" and "common" are in the root).

    root
    - admin
    -- aspx page
    - common
    -- user control

    The page works well when started from Visual Studio, but when the project is precompiled for deployment, the next error occurs:

    "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    I tried to use "Reference" in the .aspx page, but that doesn't work.

    Does anybody know any workaround for this?
  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    02-08-2006, 1:42 AM
    • Star
      14,608 point Star
    • ScottGu
    • Member since 06-05-2002, 8:36 PM
    • Redmond, WA
    • Posts 2,004
    • AspNetTeam
      Moderator

    Hi Net,

    Could you post some sample code of how the user control is being referenced?

    Also -- how are you using the user-control?  Are you programmatically referencing it, or simply declarating and using it on a page?

    Lastly -- does it work when you compile and run in Visual Studio?  Is it only when you do a publish that it fails?

    Thanks,

    Scott

  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    02-08-2006, 1:44 PM
    • Member
      77 point Member
    • net_prog
    • Member since 02-07-2006, 7:30 PM
    • Posts 21
    Hello Scott,

    Thank you for the reply.

    I don't use it in the code, just declare it in the way (declaration, usage):

    ------------------------------------------

    Register Src="../common/WebUserControl.ascx" TagName="WebUserControl" TagPrefix="uc1"
    ...
    uc1:WebUserControl ID="WebUserControl1" runat="server"

    -------------------------------------------

    (I removed some symbols to make the code appear).

    I also tried to include "Reference" directive at the page top, but that didn't work.

    Everything works when I compile the application, even when I launch it from Visual Studio (Shift+F5). This is the point where a hidden reef begins. When I precompiled the project (updatable), the page gives the error.

    I made several experiments and if I put the control into the same folder, where the page is, everything works ok.

    Also, I noticed that pages which are in the root can include any controls from "common" subfolder in the same way I described and it works.

    I.e. I understand that pages may include controls which are in "subfolders", and the problems occur when they include controls from parallel folders.

    I think this is due to the new compilation model, but maybe there is some workaround. I was searching the forum, but didn't find anything helpful, expect suggestions to use "Reference", which didn't help.

    Thanks.
    Ray.
  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    02-08-2006, 1:57 PM
    • Star
      14,608 point Star
    • ScottGu
    • Member since 06-05-2002, 8:36 PM
    • Redmond, WA
    • Posts 2,004
    • AspNetTeam
      Moderator

    Hi Ray,

    You should be able to do this scenario just fine.  If you are just using the control on a page, then you should be able to just use a <%@ Register %> directive (no refrence directive required).

    Can you send me via email (scottgu@microsoft.com) a simple project that shows this problem?  I can then help debug it more and figure out what is going on.

    Thanks,

    Scott

  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    02-08-2006, 3:06 PM
    • Member
      77 point Member
    • net_prog
    • Member since 02-07-2006, 7:30 PM
    • Posts 21
    Hello Scott,

    I just sent the project to the e-mail you provided.

    The strange thing is that I tried to make a new project to show the problem and this one works fine. That's why I attached the converted full project.

    Regards,
    Ray.
  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    03-23-2006, 6:53 PM
    • Member
      10 point Member
    • mavds
    • Member since 03-23-2006, 11:44 PM
    • Posts 2

    Hi guys,

    Did you manage to get anywhere with this? I have exactly the same problem.

    To make things even more confusing I have 5 user controls in a directory, 4 work fine but the 5th (and any subsequent ones I make) cause the error describe above.

    I've also noticed that when you publish the website a strange DLL is created. There are all of the normal DLLs  (App_Web_xxxxxx.dll) but there is an extra one called App_Web_OffendingUserControlName.ascx.xxxxx.dll. This is only DLL that is named this way; and I get one of them for every user control that doesn't work.

    I can also confirm that moving the user control to the same directory as the page that it is used on resolves the issue.

    Regards,
    Phil

  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    03-30-2006, 11:00 AM
    • Member
      83 point Member
    • priccopricco
    • Member since 07-23-2003, 5:10 AM
    • Posts 49
    Hi everyone,
        I've the some annoyng problem....
    Every time I have an upgrade to publish is a nightmare...

    my "strange" WebUC is in the "admin" subfolder and in the bin folder I have the extra dll "App_Web_adminmenu.ascx.xxxxxx.dll" and it is the only dll that is named in this way.

    I have found a solution that sometimes works...

    After having built the solution, in the pre-compiled site the page that gives me the problem has:

    <%@ Register Src="../admin/adminMenu.ascx" TagName="adminMenu" TagPrefix="uc2" %>

    and the line that thrown the error:

    <uc2:adminMenu ID="AdminMenu1" runat="server" />


    The solution that sometimes work is to give to the UserControl ID the same name of the "TagName" or removing the ID; this pieces of code work:

    <uc2:adminMenu ID="adminMenu" runat="server" />

    OR

    <uc2:adminMenu runat="server" />



    I hope this workaround should work for you too..

    Bye!

    PS: SOrry for my bad english...
  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    05-08-2006, 5:04 AM
    • Member
      40 point Member
    • Birger Niss
    • Member since 10-18-2005, 6:00 AM
    • Posts 8

    Hi everyone,

    I have precisely the same problem provided that I request the compiled application to be updatable (-u switch on aspnet_compiler). Without the switch, the problem disappears.

    Best regards

    Birger

  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    05-27-2006, 4:44 PM
    • Member
      475 point Member
    • Cal Zant
    • Member since 11-03-2005, 5:31 PM
    • Lubbock, TX
    • Posts 105

    I was getting this problem as well, and think I might have figured out what is going on.  Of course if Scott Gu puts another post up here ... I would go with whatever he suggests.

    The problem that I was having is that I was trying to precompile my site, and then move it to the live server that the site is actually hosted on.  I was getting this error because the machine that I was coding on was running the 64-bit version of the .NET Framework 2.0 (which refers to the extensions at C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727).  It turns out the computer that the site is hosted on is running the 32-bit version of the ASP.NET 2.0 (refers to the extensions at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727).

    So, what I am guessing is that when Visual Studio 2005 precompiles the code it does it with respect to a target version of the framework ... namely whatever version your computer is running.  Then when I moved that code that was designed for the 64-bit version of the .NET Framework 2.0 over to the 32-bit version ... some things that didn't match up (there has to be some differences or you would refer to the same folder for extensions).

    The solution I came up with ... don't precompile the site.  Move the files out there, and the first time the site is hit it will dynamically compile for whatever version of the .NET Framework the server is running.

  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    06-02-2006, 7:32 AM
    • Member
      5 point Member
    • rajeshckr
    • Member since 06-02-2006, 11:23 AM
    • Posts 1

    Hi,

    DId you find any resolve to this issue? I am stuck in an identical problem.

    Please let me know

    Rajesh

  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    06-05-2006, 6:26 AM
    • Member
      10 point Member
    • Maduka
    • Member since 06-05-2006, 10:18 AM
    • Posts 2

    Hi Guys

    I think i found the solution........

    Just change the CodeFile attribute in Usercontrol html in to CodeBehind ....it will work...

    In asp.net 2003 usercountrol html u get the folowing declaration..

    <%@ Control Language="c#" AutoEventWireup="true" Inherits="xxxxxxxxxxx" CodeFile="xxxxxxxxxxxxxxxxs" %>

    In asp.net 2005

    <%@ Control Language="c#" AutoEventWireup="true" Inherits="xxxxxxxxxx" CodeBehind="xxxxxxxxxxxxxx" %>

    Rgds

    Maduka

  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    06-08-2006, 4:27 PM
    • Participant
      991 point Participant
    • jjmartin
    • Member since 02-25-2004, 2:37 PM
    • Phoenix, AZ
    • Posts 203

    I can report that changing to CodeBehind did indeed solve the issue. (also reporting that I had the issue)  Doesn't make much sense tho since i have another page that works just fine with the CodeFile attribute.

    The controls are nearly identical (created by a generator).

     

    Jeff Martin
    MCSD C# .NET
    http://www.jeffmartin.com
  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    06-08-2006, 7:00 PM
    • Participant
      991 point Participant
    • jjmartin
    • Member since 02-25-2004, 2:37 PM
    • Phoenix, AZ
    • Posts 203

    So this happens every time i regenerate my code, (using .NetTiers and codesmith).

    (I'm leaving it codefile instead of codebehind as I believe codefile is supposed to be the preferred syntax).

    to let you know my configuration:

    I'm using the webadmin controls generated by .NetTiers in a Web Application Project.  The error occurs when I run it on my local machine.

    The page that it occurs on is using a very simple master page and really the only thing on the page is the content control with the NetTiers UC in it.

    As I mentioned before, it doesn't happen on all the user controls generated by NetTiers, but I can't find a difference that would do this between the control that works and the one that needs to be altered to work.

     

    Jeff Martin
    MCSD C# .NET
    http://www.jeffmartin.com
  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    06-09-2006, 1:05 AM
    • Member
      10 point Member
    • Maduka
    • Member since 06-05-2006, 10:18 AM
    • Posts 2

    Hi

    try to create a new usercontrol in vs.net 2005. It will create as CodeBehind not as CodeFile. I guess CodeBehind is the suitable property in the vs.net 2005.

    CodeFile willl work with converted .net projects(vs.net 2003 to vs.net 2005). But when you try to add new web form to converted project and try to use an user control of vs.net 2003 version, this error occurs.

    Rgds

    Maduka

  • Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

    07-20-2006, 9:28 PM
    • Member
      465 point Member
    • bigtoga
    • Member since 03-08-2004, 7:06 PM
    • Dallas, TX
    • Posts 93
    ScottGu:

    Hi Ray,

    You should be able to do this scenario just fine.  If you are just using the control on a page, then you should be able to just use a <%@ Register %> directive (no refrence directive required).

    Can you send me via email (scottgu@microsoft.com) a simple project that shows this problem?  I can then help debug it more and figure out what is going on.

    Thanks,

    Scott

    I take it you were unable to repro this using the project that Ray emailed to you (that you requested)? I'm having a similiar issue and would like to hear from you on this :)
    ===========================
    Check out my SQL Server and .NET training videos at http://www.learnitfirst.com/
Page 1 of 3 (43 items) 1 2 3 Next >