"The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"
RSS
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?
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.
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.
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.
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.
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:
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.
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.
net_prog
Member
77 Points
21 Posts
"The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not...
Feb 07, 2006 06:41 PM|LINK
ScottGu
All-Star
18285 Points
2008 Posts
Microsoft
Moderator
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
Feb 08, 2006 05:42 AM|LINK
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
net_prog
Member
77 Points
21 Posts
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
Feb 08, 2006 05:44 PM|LINK
ScottGu
All-Star
18285 Points
2008 Posts
Microsoft
Moderator
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
Feb 08, 2006 05:57 PM|LINK
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
net_prog
Member
77 Points
21 Posts
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
Feb 08, 2006 07:06 PM|LINK
mavds
Member
10 Points
2 Posts
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
Mar 23, 2006 10:53 PM|LINK
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
priccopricco
Member
83 Points
49 Posts
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
Mar 30, 2006 03:00 PM|LINK
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...
Birger Niss
Member
40 Points
8 Posts
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
May 08, 2006 09:04 AM|LINK
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
Cal Zant
Member
475 Points
105 Posts
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
May 27, 2006 08:44 PM|LINK
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.
rajeshckr
Member
5 Points
1 Post
Re: "The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is...
Jun 02, 2006 11:32 AM|LINK
Hi,
DId you find any resolve to this issue? I am stuck in an identical problem.
Please let me know
Rajesh