Quantcast
Viewing all articles
Browse latest Browse all 8

Generation of designer file failed

The error message “Generation of designer file failed: Unknown server tag ‘EPiServer:Property'” in Visual Studio can really drive me mad.

Image may be NSFW.
Clik here to view.

Today it happened again. I noticed that I could not recompile my application because the new textbox I added to my ASPX-file did not appear as a member in the corsponding designer.cs-file.

First, I double check that I installed SP1 for Visual Studio 2005 so I have the latest version of Web Application Projects.

The Usual Trick

When this happens it is in most cases an indication of a syntax error in the ASPX-file. In many cases you get so many strange errors and warnings in Visual Studio’s Error List so you do not understand what is wrong. A quick way to get a good error message and be certain that the designer.cs-file is in sync is to first delete it and then regenerating it by right-clicking the ASPX-file in the Solution Explorer and selecting “Convert to Web Application”.

This works in most cases. Either you will get an error you will understand how to fix or it just regenerates the designer.cs-file for you.

Permanent Frustration

Sometimes you will fail to generate the file and nothing you do seem to help. Everything is in order. No syntax errors in the ASPX-file. It just refuses to regenerate the designer file because it cannot find component X.

Obviously I’m not alone getting this problem. I’m not sure why it stops working but I guess part of the problem is related to the ASPX-file must be parsed first and something is wrong with the environment.

Tim McBride on the ASP.NET team hints how to get more information by turning on debugging for Web Application Projects.

REGEDIT4 
[HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio8.0WebApplicationProjectsDebug] 
"LogFile"="C:logfile.txt" 
"Enabled"=dword:00000001" 
LogFieldGeneratorFailures"=dword:00000001 

And with a call stack we have more information where it goes wrong:

System.Web.HttpParseException: Unknown server tag 'EPiServer:Property'. 
   at System.Web.UI.TemplateParser.ProcessError(String message) 
   at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText) 
   at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) 
   --- End of inner exception stack trace --- 
   at System.Web.UI.TemplateParser.ProcessException(Exception ex) 
   at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) 
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) 
   --- End of inner exception stack trace --- 
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) 
   at System.Web.UI.TemplateParser.ParseInternal() 
   at System.Web.UI.TemplateParser.Parse() 
   at System.Web.UI.DesignTimeTemplateParser.ParseTemplate(DesignTimeParseData data) 
   at Microsoft.VisualStudio.Web.Application.Parser.Parse() 
   at Microsoft.VisualStudio.Web.Application.Generator.UpdateDesignerClass(String document, String codeBehind, String codeBehindFile, String[] publicFields, UDC_Flags flags) 

ProcessBeginTag cannot map a tag to a control. The tag EPiServer:Property control is not registered on the page but in the <system.web><pages><controls> section in web.config. This indicates that something fails either in TemplateParse.PrepareParse when trying to get hold of the RuntimeConfig or in Microsoft.VisualStudio.Web.Application.Parser.ParseConfig when it tries to get to web.config through the designer host.

Adding a Register directive manually to the Page will remove the first error and reveal another.

System.Web.HttpParseException: The expression prefix 'Resources' was not recognized.  Please correct the prefix or register the prefix in the <expressionBuilders> section of configuration. 
   at System.Web.Compilation.ExpressionBuilder.GetExpressionBuilder(String expressionPrefix, VirtualPath virtualPath, IDesignerHost host) 
   at System.Web.UI.ControlBuilder.AddBoundProperty(String filter, String name, String expressionPrefix, String expression, ExpressionBuilder expressionBuilder, Object parsedExpressionData, Boolean generated, String fieldName, String formatString, Boolean twoWayBound) 
   at System.Web.UI.ControlBuilder.PreprocessAttribute(String filter, String attribname, String attribvalue, Boolean mainDirectiveMode) 
   at System.Web.UI.ControlBuilder.PreprocessAttributes(ParsedAttributeCollection attribs) 
   at System.Web.UI.ControlBuilder.Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs) 
   at System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty) 
   at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText) 
   at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) 

The code in GetExpressionBuilder gives the same indication and strengthens my suspicion that the parser fails to get hold of any configuration at all since the <expressionBuilders> tag is in the global web.config.

I’m too tired to continue the hunt for the real reason tonight but I did test one final thing:

  1. I shut down the IIS service and close Visual Studio.
  2. And then do I delete all files under “Temporary ASP.NET Files”.
  3. I restart Visual Studio and re-open the Project.
  4. I change Project Settings to use Visual Studio Development Server instead of IIS.
  5. Finally do I click “Convert to Web Application” and this time it generates without errors…

Why? Maybe you know… Please, leave a comment if you have any clues!


Viewing all articles
Browse latest Browse all 8

Trending Articles