Sunday, June 1, 2014

How to re-create designer.cs in Visual Studio 2013

Some time you may have to re-create .designer.cs file of your .aspx page. There can be many reason for re-generating this file. You must be surprised to know that there is no direct option to re-generate .designer.cs file. All you have to do is workaround, but it generates the file without any error and application doesn’t throw any error.
Let’s see the step by step process by deleting the designer .cs first.
image

After deleting the designer file just expand your .aspx page you will notice that file is no longer exists.
 image .
Now we will re-generate the designer file. For that you have to select the .aspx file where you want to generate the designer file and then click on the “PROJECT” menu and then click on “Convert to Web Application”.
image
Once you click on “Convert to Web Application” you will get an alert saying system will add code behind and designer files for the selected web page. Click Yes to add the designer file.
image
Now you can see that the deleted designer file for your web page.
image
I hope this helps for many who has been struggling to re-create missing or corrupted designer file.

No comments: