Missing or corrupted designer file causes Visual studio
(VS) to fail the build. This is because without designer file VS is unable to
find the declarations of controls. Also most of the time
controls are not added to designer.cs giving build errors.
controls are not added to designer.cs giving build errors.
To fix this issue, Below is the simplest solution I know:
- Delete your designer file if it is corrupted else start from step2.
- Go to your aspx markup (source) page and find below line of code. <%@ Page Language="C#" AutoEventWireup="false" CodeFile="SamplePage.aspx.cs" Inherits=" SamplePageClass" %>
- Now change CodeFile tag to CodeBehind.
- Save the file.
- Rebuild your project (This will create designer file for your page)
- Revert your change (Step3).

5 comments:
Thank you! I had this problem, and the other solutions I found on the net (simply refresh, exclude from project and re-add, change to WebApplication etc) didn't work for me. This one did.
Mr Lister, I am glad to know that you tried this solution and it worked for you!
Thanks, I'm both shocked and grateful that this actually worked. :P
...And I am happy that it worked for you :)
Thank you a lot.
Post a Comment