How to create designer class manually

When we add a control (ex. ) to an ascx or aspx file, visual studio is supposed to automatically add the definition for that control to the designer.cs file (associated with that ascx or aspx). But it is not added or updated properly in VS2008.

It seems most of the developers are facing this issue. We need to regenerate the designer class to solve this issue To regenerate the .designer.cs file for a ASPX/ASCX, first delete the .designer.cs file, then right click on the ASPX/ASCX and click “Convert to Web Application”. This will probably give you an error message that will help you find the root of the problem. I noticed that there's a difference in the error message you might get here versus the file that is being opened in the Design mode in Visual Studio. For example, we had a .ASPX file where the .designer.cs file was not being generated when we modified it. We could not figure out what the error was until we discovered this tip because Visual Studio did not give us any feedback. Once I deleted the .designer.cs and ran “Convert to Web Application” on the file, I was prompted with an error message that informed me that we had a <%@ Register /> declaration in our ASPX that was also declared in our web.config file (and this was creating a conflict even if they both pointed to the same location).

Visual Studio could benefit from better error reporting for this particular scenario.