We port our web applications from the .NET framework 3.5 to 4.5
On our development machines, we use VS2012 and run Windows 7
In this process, we received the following error:
The base class includes the "htmlTag" field, but its type (System.Web.UI.HtmlControls.HtmlGenericControl) is not compatible with the type of the control (System.Web.UI.HtmlControls.HtmlElement)
Matching HTML
<html xmlns="http://www.w3.org/1999/xhtml" class="no-js" runat="server" id="htmlTag">
And the corresponding developer code (.cs.designer file)
protected global::System.Web.UI.HtmlControls.HtmlGenericControl htmlTag;
Full stack trace here.
System.Web.HttpParseException (0x80004005): the base class includes the "htmlTag" field, but its type (System.Web.UI.HtmlControls.HtmlGenericControl) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlElement). in System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildFieldDeclaration (ControlBuilder builder) in System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildSourceDataTreeFromBuilder (ControlBuilder builder Boolean fInTemplate, Boolean topLevelControlInTemplate, PropertyEntry PSE) in System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildSourceDataTreeFromBuilder (ControlBuilder builder , Boolean fInTemplate, Boolean topLevelControlInTemplate, PropertyEntry pse) in System.Web.Compilation.TemplateControlCodeDomTreeGenerator.BuildMiscClassMembers () in System.Web.Compilation.PageCodeDomTree.ecomecodememetmebecmemetecomecmecmememececmememececme .Compilation.BaseCodeDomTreeGenerator.GetCodeDomTree (CodeDomProvider codeDomProvider, StringResourceBuilder stringResourceBuilder, VirtualPath virtualPath) in System.Web.Compilation.BaseTemplateBuildProvider.GenerateCode (As semblyBuilder assemblyBuilder) in System.Web.Co mpilation.AssemblyBuilder.AddBuildProvider (BuildProvider buildProvider) in System.Web.Compilation.AssemblyBuilder.AddBuildProvider (BuildProvider.Ppuiler.Compiler. .BuildProvidersCompiler.PerformBuild () on the system. Web.Compilation.BuildManager.CompileWebFile (VirtualPath VirtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal (VirtualPath VirtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean, Boolean allowBuildInPrecompile throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert (context HttpContext, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean obespechivayutIsUpToDate) in System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory (VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) in Syste m.Web .Compilation.BuildManager.CreateInstanceFromVirtualPath (VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) in Sys tem.Web.UI.PageHandlerFactory.GetHandlerHelper (HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) in System.Web. HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute () in System.Web.HttpApplication.ExecuteStep (step IExecutionStep, Boolean & completed synchronously) Error method: Void AddBuildProvider (System.Web. reference.Web.
To fix this problem, we have completed the steps specified in this link http://support.microsoft.com/kb/941824/en-us
In essence, we just cut out the HTML and paste it back .. and the designer code is regenerated as follows
protected global::System.Web.UI.HtmlControls.HtmlElement htmlTag;
It seems logical to fix this problem, and it also worked on several machines, but the same code fixed the code on other developer's machines, and especially the code deployed on our production web server. Please note: we are running Windows Server 2008 R2 Datacenter on our production server and the .NET Framework 4.5 is installed on it. Below is the error we receive after the change
The base class includes the 'htmlTag' field, but its type (System.Web.UI.HtmlControls.HtmlElement) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl)
You see an error message directly opposite the first error message in this message
On machines that are now mistaken, if we just leave the HTMLGenericControl control HTMLGenericControl , the error goes away
We tried to compare service packs associated with the .net network on machines that work against those that do not work, and we really did not notice anything that could cause an error.
This situation is unacceptable, because the teams are distributed across several geographical locations, and we cannot coordinate with each of them the way to fix their local environment. Moreover, we cannot register this file with changes, since it will break for many people, and it will be difficult to release it for production.
Could you help us solve this problem?