Aarrrggghhh: "The file could not be loaded into the Web Forms designer. Please correct the following error and then try loading it again"
Darn. Darn. Darn. This error has almost cost me a whole day!
If anyone gets this in VS.NET 2003 (I'm doing a VB.NET web project), then here's some solutions:
Workaround #1
Are you using page inheritance? If so, make sure none of your pages declare AND initialise attributes on the same line. So DO NOT do this:
private _securityGateway as Gateway = GatewayFactory.Create()
Instead do this:
private _securityGateway as Gateway
public sub Page_Load(...)
_securityGateway = GatewayFactory.Create()
end sub
This fixed my problems, but I'd already spent all day trying other things :-( Those were...
Workaround #2
Try removing (not deleting) the file from your Visual Studio Solution, and then re-add it back in.
Workaround #3
Delete all files from your Visual Studio web cache. E.g:
C:\Documents and Settings\Tobin Harris\VSWebCache\TOBINSLAPTOP\SomeProject
Workaround #4
Close Visual Studio and then delete as many files as possible from your temp folder. Eg:
C:\Documents and Settings\Tobin Harris\Local Settings\Temp
Anyway, hope that saves someone a day or hair pulling! Can't believe I got so stuck on this, I've never encountered such problems with C# web solutions. Ho hum...
5 Comments:
If you're using page inheritance, I found that changing the line "Inherits SOME_PAGE" line to "Inherits System.Web.UI.Page" and then opening the designer fixes the issue. You can then change the inherits line back to its original form and the designer won't throw the error.
Thanks Sean. You saved me a lot of time.
Best regards
Tommy
This solution worked for me:
References:
System
System.Data
System.Drawing
System.Web
System.Web.Services
System.XML
When you add any non Microsoft references to your project, sometimes the reference path for the base classes change. This causes the error.
The above classes should be pointing to your local framework path in their properties.
It should be (or similar): C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\
You might have to remove and then add those base references again.
This path should also be included in the main reference paths of the project and should be at the top.
Recompile, then all the pages should open in the designer.
Good luck!
Hey Workaround #2 funda worked for me . Thanks a lot
Hey Workaround #2 worked for me
Thanks a lot
Post a Comment
<< Home