Geeks With Blogs

Charles Young

I had an unpleasant time yesterday afternoon re-stabilising an ASP.NET 2.0 application after it went berserk.   I don't do that much coding in ASP.NET these days, but when I do, I seem to run into lots of problems. A fellow developer on the same project wasn't very helpful or sympathetic - he sat there and informed everyone in a loud voice that he'd just come off another project where he'd built a much larger ASP.NET app without any problems at all.   Yes, thanks for the support!

I had several problems layered on top of one another, including those strange issues where Visual Studio 2005 seems to get into a complete mess somehow with assembly references. I also saw evidence of Visual Studio putting incorrect duplicate file references into the project file. Killing every bin and obj folder and deleting the entire contents of the Temporary ASP.NET Files folder helped no end. However, I had one problem that I couldn't clear for ages.   Certain .aspx pages constantly reported errors associated with their @Page directives.   One page, in particular, constantly reported this error (even after I had re-built the page from scratch), and others intermittently reported the same error!   The error message stated that:

"There is no build provider registered for the extension ''. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'."

Why on earth would I need to register a build provider for non-existent file extensions?   The problem seemed also to manifest itself in an inability to find a master page unless I provided a fully qualified path name.   Another strange thing was that sometimes a different error would be reported by Visual Studio saying that part of the path to the web application directory could not be found.   Needless to say the path was correct and present.   The problem survived cleaning down the project and rebooting the system. 

I tried everything I could think of to solve the issue.   Nothing worked until, by trial and error, I hit on a solution.   In Web.Config, I added the following buildProviders extension entry to the compilation element:

    <compilation debug="true">
          <add extension="*" type="System.Web.Compilation.PageBuildProvider"/>

Success!   The problem disappeared.   I then had the presence of mind to IMMEDIATELY go back and comment out the buildProvider entry. The problem did not come back!   Whatever happened when I added the build provider seems to have solved the underlying issue.

I can't explain the cause, but I can see a few reports of the same delinquent behaviour when I Google.   Hopefully this will be of help to someone out there.   I really do hope Microsoft has put some effort into stabilising Visual Studio 2008 rather than just concentrating on adding features.

Also, before someone asks, yes, I do have Visual Studio 2005 SP1 installed, and yes, I am using a Web Application project rather than a Web Site project.

Posted on Thursday, September 13, 2007 1:21 PM | Back to top

Comments on this post: ASP.NET 2.0: Build provider and master page issue

# re: ASP.NET 2.0: Build provider and master page issue
Requesting Gravatar...
Whatever it is that causes these errors (the "build provider" error and the "could not find part of the path" error) appears to also cause problems with custom control tags.

Your fix temporarily got rid of the "build provider" error (it came back when opening another page), but did not get rid of the other 2.

I've run into the problem with custom control tags getting "lost" and the fix was to clear the ReflectedSchemas folder (C:\Documents and Settings\USERNAME\Application Data\Microsoft\VisualStudio\8.0\ReflectedSchemas). So I did that again and it got rid of all 3 errors for me.

Note, the "Application Data" folder is hidden.
Left by shep on Nov 17, 2007 7:39 PM

# re: ASP.NET 2.0: Build provider and master page issue
Requesting Gravatar...
I Am doing on work one tire arc and i made to many pages
now i made master page then run web page no open master page
Left by anush on Sep 21, 2008 3:06 AM

# re: ASP.NET 2.0: Build provider and master page issue
Requesting Gravatar...
Clearing the ReflectedSchemas folder worked, but you have to close and restart VS 2005 for the error messages to go away.
Left by Paul Taylor on May 13, 2009 11:07 AM

Your comment:
 (will show your gravatar)

Copyright © Charles Young | Powered by: