Hi,
We are migrating our Web applications from .NET framework 3.5 to 4.5
On our development machines, we are using VS2012 and run Windows 7 OS
In this process we got the following error
"The base class includes the field 'htmlTag', but its type (System.Web.UI.HtmlControls.HtmlGenericControl) is not compatible with the type of
control (System.Web.UI.HtmlControls.HtmlElement)"
The corresponding HTML is
<htmlxmlns="http://www.w3.org/1999/xhtml"class="no-js"runat="server"id="htmlTag">
And the corresponding designer code is (.cs.designer file)
protectedglobal::System.Web.UI.HtmlControls.HtmlGenericControl htmlTag;
Full stack trace here..
System.Web.HttpParseException(0x80004005):Thebaseclass includes the field 'htmlTag', but its type (System.Web.UI.HtmlControls.HtmlGenericControl)isnot compatible with the type of control (System.Web.UI.HtmlControls.HtmlElement). at System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildFieldDeclaration(ControlBuilder builder) at System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildSourceDataTreeFromBuilder(ControlBuilder builder,Boolean fInTemplate,Boolean topLevelControlInTemplate,PropertyEntry pse) at System.Web.Compilation.BaseTemplateCodeDomTreeGenerator.BuildSourceDataTreeFromBuilder(ControlBuilder builder,Boolean fInTemplate,Boolean topLevelControlInTemplate,PropertyEntry pse) at System.Web.Compilation.TemplateControlCodeDomTreeGenerator.BuildMiscClassMembers() at System.Web.Compilation.PageCodeDomTreeGenerator.BuildMiscClassMembers() at System.Web.Compilation.BaseCodeDomTreeGenerator.BuildSourceDataTree() at System.Web.Compilation.BaseCodeDomTreeGenerator.GetCodeDomTree(CodeDomProvider codeDomProvider,StringResourceBuilder stringResourceBuilder,VirtualPath virtualPath) at System.Web.Compilation.BaseTemplateBuildProvider.GenerateCode(AssemblyBuilder assemblyBuilder) at System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean allowBuildInPrecompile,Boolean throwIfNotFound,Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context,VirtualPath virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean allowBuildInPrecompile,Boolean throwIfNotFound,Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath,HttpContext context,Boolean allowCrossApp,Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath,Type requiredBaseType,HttpContext context,Boolean allowCrossApp) at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context,String requestType,VirtualPath virtualPath,String physicalPath) at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)ErrorMethod:VoidAddBuildProvider(System.Web.Compilation.BuildProvider)HelpLink:-->
To fix this issue we followed the steps given at this link http://support.microsoft.com/kb/941824/en-us
In essence we just cut the HTML and paste it back.. and the designer code is regenerated as follows
protectedglobal::System.Web.UI.HtmlControls.HtmlElement htmlTag;
This looks logical way to fix the issue and it also worked on few machines (once we built the solution with this change and dropped the dlls to local webserver, the website started working) but the same fix broke code on other developer machines and especially code deployed to our production web server too. Please note, we run Windows Server 2008 R2 Datacenter on our production server and we have .Net Framework 4.5 installed on the machine. The following is the error we get after the change
"The base class includes the field 'htmlTag' but its type (System.Web.UI.HtmlControls.HtmlElement) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl)"
You see the error message is just opposite to the first error message in this post
In those machines which now error, if we just leave the type of the control to HTMLGenericControl the error goes away
We tried to compare the .net framework related service packs on the machines that work vs the ones that dont and we really did not notice anything that could possibly cause the error
This situation is unacceptable since we have teams spread across multiple geographic locations and we cannot coordinate with each of them about the way to fix their local environment. More over we cannot check-in this file with changes since it will break for many people and releasing this to production is going to be difficult too
Could you please help us resolve this issue
Thanks,
Siva